Giter Club home page Giter Club logo

Comments (4)

Evertt avatar Evertt commented on May 27, 2024 1

@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.

mfn avatar mfn commented on May 27, 2024

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.

mreduar avatar mreduar commented on May 27, 2024

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.

mfn avatar mfn commented on May 27, 2024

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

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.