VSCode Intellisense for Laravel Realtime Facades
Asked Answered
C

1

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?

Civies answered 10/12, 2019 at 3:39 Comment(1)
It's lack of support for @mixin. There is an equivalent issue in vscode-intelephense. Unfortunately also not yet fixedAnnorah
B
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.

Bullins answered 28/2, 2022 at 20:52 Comment(1)
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.Cohn

© 2022 - 2024 — McMap. All rights reserved.