vscode-intelephense icon indicating copy to clipboard operation
vscode-intelephense copied to clipboard

1.10.3 finds classes in Laravel app to be undefined

Open mariordev opened this issue 1 year ago • 5 comments

Describe the bug After upgrading to 1.10.3, now virtually all classes are reported as undefined. The code has not changed, and this was working perfectly fine before version 1.10.3.

To Reproduce Use any class, like Log::debug('this is a test') in a Laravel app. The Log class is reported as undefiined, even with proper use Illuminate\Support\Facades\Log statement in place.

Or, use Laravel's helper function app(YourClassName::class) and the app function is reported as not found (or undefined).

Expected behavior Classes that have a proper corresponding use statement should not be reported as undefined.

Platform and version MacOS and Intelephense versions 1.10.3 and 1.10.4.

mariordev avatar Mar 26 '24 19:03 mariordev

Upgrade to 1.10.4 and try reindexing. ctrl + shift + p -> Index workspace.

bmewburn avatar Mar 26 '24 21:03 bmewburn

Upgrade to 1.10.4 and try reindexing. ctrl + shift + p -> Index workspace.

Hi @bmewburn, thanks for your reply. I did that, but still having the same issue unfortunately. Here's an example, but basically it's not finding any classes/functions.

Screen Shot 2024-03-29 at 2 32 42 PM

mariordev avatar Mar 29 '24 21:03 mariordev

same issue for me Screenshot 2024-06-12 at 19 33 19

kirkkhua avatar Jun 12 '24 16:06 kirkkhua

Me too. Mac M3 Pro

guixiaomin avatar Jun 29 '24 15:06 guixiaomin

@kirkkhua Laravel global namespaced facades are generated by laravel at runtime so if they are not found it's likely you need a helper file which declares them. Packages like https://github.com/barryvdh/laravel-ide-helper can create one for you or you can do it manually.

@mariordev Does the 1.11 pre-release fix your issue?

bmewburn avatar Jun 29 '24 22:06 bmewburn

@bmewburn thanks Ben! The one you recommended conflicts with carbon.

kirkkhua avatar Jul 01 '24 17:07 kirkkhua

@kirkkhua Laravel global namespaced facades are generated by laravel at runtime so if they are not found it's likely you need a helper file which declares them. Packages like https://github.com/barryvdh/laravel-ide-helper can create one for you or you can do it manually.

@mariordev Does the 1.11 pre-release fix your issue?

Hey Ben, thanks! Unfortunately, it's still the same :(

Screen Shot 2024-07-04 at 4 47 05 PM Screen Shot 2024-07-04 at 4 45 00 PM

mariordev avatar Jul 04 '24 23:07 mariordev

@mariordev , I'm having trouble reproducing the issue. A few things you could try are:

  • Reset all intelephense settings to the default.
  • Check that the laravel framework is actually in your open folder tree and that it hasn't been excluded with an exclude glob.
  • Check the intelephense output tab for errors.
  • Remove the extension completely and reinstall.

bmewburn avatar Jul 05 '24 01:07 bmewburn