7

When using realtime facades in Laravel, VSCode doesn't seems to provide intellisense or autocompletion. Even when using popular plugins like PHP Intelliphense I can't get it to work. However, when I import the class normally it works just fine.

For example, this has no intellisense/autocompletion features:

use Facades\App\User;
User::auth();

But this does:

use App\User;
User::auth();

I feel like this has to be a common problem since Facades are a core concept in Laravel. Does anyone know a workaround or solution to this problem?

UglyBoogaloo
  • 165
  • 1
  • 6
  • It's lack of support for @mixin. There is an equivalent issue in [vscode-intelephense](https://github.com/bmewburn/vscode-intelephense/issues/123). Unfortunately also not yet fixed – Lukas Aug 20 '20 at 13:40

1 Answers1

1

Maybe you want to give this package a try:

https://github.com/barryvdh/laravel-ide-helper

It fixes the facades problem for you visual studio, as they say in the package description:

This package generates helper files that enable your IDE to provide accurate autocompletion. Generation is done based on the files in your project, so they are always up-to-date.

leopinzon
  • 707
  • 6
  • 13
  • It's worth noting that there's a VS Code extension called `Laravel Ide Helper` that runs `laravel-ide-helper` commands on `*.php` file saves to keep things up-to-date. – Joel Mellon Aug 28 '23 at 21:08