Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion Issues #32

Open
frugene opened this issue Oct 30, 2024 · 10 comments
Open

Completion Issues #32

frugene opened this issue Oct 30, 2024 · 10 comments

Comments

@frugene
Copy link

frugene commented Oct 30, 2024

There are no completion of php code when in @php directive and {{}}.
Does this support livewire?
Can there be an implementation?
Is there already a plugin for above issues?

BUG: I don't know if it really is a bug or not but when a completion is provided by blade-nav, there are two entries of the suggestion.

@RicardoRamirezR
Copy link
Owner

@frugene, please provide an code example of the issue.

For the questions take a look at the readme numeral 4

@frugene
Copy link
Author

frugene commented Oct 31, 2024

I see it does support livewire but there is no completion of php code when in @php directive and {{}} (blade echo).

For eg:

@php
{{--There is no completion here for php code.--}}
@enphp
<p data={{somevariable}}>Hello</p> -> there is no completion for somevariable even if somevariable was passed to the view

@frugene
Copy link
Author

frugene commented Oct 31, 2024

For the questions take a look at the readme numeral 4

I have looked at it but for this issue:

There are no completion of php code when in https://github.com/php directive and {{}}.

There is no help

@RicardoRamirezR
Copy link
Owner

RicardoRamirezR commented Oct 31, 2024

Ahh I see @frugene. The completion is for components only.

@frugene
Copy link
Author

frugene commented Oct 31, 2024

Oo ok. But do you have any idea how to get those autocomplete.
If there are plugins or i should write login for attaching the lsp buffer of php inside @php directive and {{}}.

@RicardoRamirezR
Copy link
Owner

I do not know, may be phpactor...

@monooso
Copy link

monooso commented Nov 15, 2024

@RicardoRamirezR Possibly related, after installing this plugin Intelephense autocompletion stopped working. Not just in Blade files, but in pure PHP files as well. I'm assuming this is because I have ft = {'blade', 'php'}, as per the setup instructions.

My guess is that this has something to do with the cmp.lua file, but that's just a theory at this point.

Were it not for Laravel Folio and Livewire Volt, I could probably work around this by setting ft = {'blade'}. As it stands, I have to choose between Blade completion / navigation, and PHP completion. Not surprisingly, the latter wins.

Thanks for all your work on this.

monooso added a commit to monooso/dotfiles that referenced this issue Nov 15, 2024
It completely breaks Intelephense autocompletion in both Blade and PHP
files, for reasons I don't quite understand. There is a possibly-related
issue on the repository [1].

[1]:
RicardoRamirezR/blade-nav.nvim#32 (comment)
monooso added a commit to monooso/dotfiles that referenced this issue Nov 15, 2024
It breaks Intelephense autocompletion, which is a non-starter.

See [this issue][1] for details.

[1]:
RicardoRamirezR/blade-nav.nvim#32 (comment)
@RicardoRamirezR
Copy link
Owner

RicardoRamirezR commented Nov 18, 2024

Hey @monooso, can you provide a minimal file to reproduce the issue. I do have Intelephense and works on my side

@monooso
Copy link

monooso commented Nov 22, 2024

Hi @RicardoRamirezR, sorry for the slow response. I'm wrapping up a project today, so it's been a little hectic. I'll take another look at this next week.

monooso added a commit to monooso/dotfiles that referenced this issue Nov 26, 2024
@monooso
Copy link

monooso commented Nov 26, 2024

@RicardoRamirezR I've managed to identify when the issue occurs, using a minimal init.lua and the Breeze Livewire starter files1.

As far as I can tell, this mostly boils down to filetypes.

Using the default Intelephense config

By default Neovim correctly identifies a file with the extension .blade.php as having a filetype of blade.

In this scenario:

  • blade-nav works correctly within the Blade portion of the file.
  • intelephense does not work within the PHP portion of the file. This makes sense, because by default it's not associated with Blade files.

Manually setting the filetype to php results in the following:

  • blade-nav does not work within the Blade portion of the file. I can see why this makes sense, given that you do something different within controllers, etc.
  • intelephense works correctly within the PHP portion of the file.

Using a custom Intelephense config

At this point, I figured the solution was to tell intelephense that it needs to work with both blade and php files. That's when things got a little weird.

In this scenario, when the filetype is blade:

  • blade-nav continues to work correctly.
  • intelephense is correctly attached to the buffer, but does nothing.

And when the filetype is php:

  • blade-nav doesn't work, naturally.
  • intelephense is correctly attached to the buffer, but still does nothing.

So, in conclusion, intelephense only appears to work when the filetype is php and I haven't meddled with the intelephense filetype associations.

But how?

As all of the above points to an intelephense bug, I'm very curious how you managed to get it working?

Footnotes

  1. For example, the login.blade.php component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants