Comments (4)
@mreduar Well I'm starting to think that I should just completely and only rely on phpstan with larastan.
Please can you tell me more about the extension you use to detect the scopes without the with?
It seems I was mistaken. I just turned off the extension that I thought was making that work (which was this one), but it turns out that extension was not making the making possible, cause it still worked when I turned it off. Then I thought maybe phpstan / larastan was doing it, but I disabled those too and then it still worked. Turns out that somehow _ide_helper_models.php
was making it work, because it stopped working when I deleted that file, even though I don't completely understand how. Because I can't see how that file, which defines the scoped method simply like @method static \Illuminate\Database\Eloquent\Builder|TrainingDate search($search)
, can make VSCode understand that that refers to the scopeSearch
method on the model.
I think I'm making things very confusing for myself by having so many extensions and packages installed to improve VSCode's intellisense and now I find it hard to determine what extension or package is doing what exactly.
Edit
But in the end, I've been talking to the maintainers of larastan, and it seems like the features that they are missing (which laravel-ide-helper is currently complementing) is because some of their templates / stubs are a little out of date. But they intend to update them and then their thing should be able to offer all the intellisense that laravel-ide-helper is also offering.
from laravel-ide-helper.
Using templates certainly looks like a direction worth exploring, given nothing else breaks, including PhpStorm, phpstan, psalm, etc. Or at least have some sense of assessment if it causes collateral changes.
from laravel-ide-helper.
Hello @Evertt Have you found a solution?
Please can you tell me more about the extension you use to detect the scopes without the with?
Strictly speaking, I don't even need the line for search there, because one of my extensions is already smart enough to be able to link search() to scopeSearch(), but it's fine. So when I do this, things work completely fine:
from laravel-ide-helper.
Because I can't see how that file, which defines the scoped method simply like
@method static \Illuminate\Database\Eloquent\Builder|TrainingDate search($search)
, can make VSCode understand that that refers to thescopeSearch
method on the model
It doesn't: ide-helper finds scopeSearch
and therefore creates the method in the phpdoc you see, that's it.
The IDE (that file format was "invented" by IntelliJ for PhpStorm, other might/might not follow) then reads this file and off you go. Besides ide-helper being the generator, there's no "connection" that ::search
goes to scopeSearch
.
FWIW, IMHO it's recommended to not use the _ide_helper_models.php
file and just let the PHP doc write directly to the models. That might also increase compatibility with other IDEs not knowing about that file but which are able to look at the phpdoc attached to the class directly.
from laravel-ide-helper.
Related Issues (20)
- It just doesn't suggest methods from Illuminate\Database\Eloquent\Builder on my model, like "first()" or "where()" HOT 4
- Installation error on latest laravel installation HOT 3
- Is it Possible to Add auto-complete in form request classes?
- Models that have `static::$snakeAttributes` set to `true` should use attribute names without case conversion
- Allow configuration of the expectedMixins when calling Eloquent::writeEloquentModelHelper()
- Model's --write duplicates array properties that have summary and array key-value types added HOT 3
- Modifications required to support Laravel 11 HOT 1
- [idea] Refactor to use phpstan/phpdoc-parser HOT 2
- [2.15.0] Inserting AllowDynamicProperties attribute breaks final classes HOT 4
- Nova Resources HOT 8
- Mixin Information Provided by Packages HOT 2
- Attribute accessor/mutator without the counterparts generate wrong model properties HOT 1
- Support for Eloquent Scope extensions HOT 1
- Not working with MSSQL 2016 and below HOT 2
- Wrong return type get() method HOT 1
- @mixin Alternative HOT 1
- Comment keeps getting appended
- The command "ide-helper:models" is not working correctly. HOT 1
- Exception: No query results for model inside on mutator or accessor HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-ide-helper.