georgyKurian / vscode-laravel-ide-helper

VS Code Laravel Ide Helper Extension
https://marketplace.visualstudio.com/items?itemName=georgykurian.laravel-ide-helper
GNU General Public License v3.0
5 stars 3 forks source link

not working inside of controller #6

Open MahGolden opened 1 year ago

MahGolden commented 1 year ago

laravel ide helper, works in web.php or factories, but inside of controller not working , any solution ? Please!

netzknecht commented 1 year ago

Same for me.

Methods of a my \App\Mixin\BuilderMixin class mixed in to the \Illuminate\Database\Eloquent\Builder class will suggested on autocomplete inside a route file e.g. web.php, but not inside a Controller file.

As a workaround I've defined my methods inside a trait and use it in the relevant models or base model.

netzknecht commented 1 year ago

I've noticed, that this affects only the \Illuminate\Database\Eloquent\Builder and \Illuminate\Database\Eloquent\Model. If I extend the \Illuminate\Database\Query\Builder with a macro or mixin, the code suggestion works inside Controller files, too.

MahGolden commented 1 year ago

thanks a lot, but to be honest I didn't get what you have done exactly, could you kindly explain to me how you have solved?

netzknecht commented 1 year ago

Sorry for the late reply... it seems to me, this issue is more relating to the combination of vsc extension, not an issue of the "laravel-ide-helper" at all. spend a lot of time to get intellisense, code suggestion, snippets and more smoothly running with laravel in vsc, because some php/laravel vsc extensions doesn't like each other. Here is my current php and laravel relating extension setup for laravel devcontainer's with best experience. Summarized, "laravel-ide-helper" works best with vsc standard PHP tools "DEVSENSE.phptools-vscode", other php intellisense or intelephens extensions doesn't.

[ "formulahendry.auto-close-tag", "formulahendry.auto-rename-tag", "DEVSENSE.phptools-vscode", "DEVSENSE.composer-php-vscode", "xdebug.php-debug", "mikestead.dotenv", "ryannaddy.laravel-artisan", "austenc.laravel-docs", "amiralizadeh9480.laravel-extra-intellisense", "georgykurian.laravel-ide-helper", "webdevsavvy.blade-components", "onecentlin.laravel-blade", "austenc.laravel-blade-spacer", "ctf0.laravel-goto-controller", "codingyu.laravel-goto-view", "onecentlin.laravel5-snippets", "naoray.laravel-goto-components", ],

In addition I use some tailwindcss and vue relating extensions and git graph, also.

For model code suggestion you have to save a model file first or run model helper / all helper command in vsc.