Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDE autocomplete #71

Closed
vatsake opened this issue Feb 9, 2024 · 10 comments
Closed

IDE autocomplete #71

vatsake opened this issue Feb 9, 2024 · 10 comments
Labels
help wanted Extra attention is needed

Comments

@vatsake
Copy link

vatsake commented Feb 9, 2024

How does one make IDE understand Tpetry\PostgresqlEnhanced\Query\Builder methods?

:)

@tpetry
Copy link
Owner

tpetry commented Feb 10, 2024

This is something I am unhappy with for a long time. But I don't know how to fix it 🤷‍♂️

Recently, Laravel Idea shared that they will support this with their next update [0]. But I don't know any approach for VSCode or PHP Storm without the plugin.

[0] https://x.com/laravel_idea/status/1755279230210904084?s=20

@tpetry tpetry added the help wanted Extra attention is needed label Feb 10, 2024
@boris-glumpler
Copy link

I've added a .phpstorm.meta.php file to my project root with the following contents:

<?php

declare(strict_types=1);

namespace Illuminate\Database\Eloquent {
    /**
     * @mixin \Tpetry\PostgresqlEnhanced\Query\Builder
     */
    class Builder {}
}

namespace PHPSTORM_META {
    //metadata directives
}

@tpetry
Copy link
Owner

tpetry commented Feb 10, 2024

Hmm, but that file would still need to be copied. And potentially conflicts with other packages wanting to do the same. Would be awesome if it could be at the root dir of every package in the vendor dir. So, every package could provide their own always-updated definitions.

@boris-glumpler
Copy link

Yup, this isn't a solution for packages and def feels hacky, but it's worked well for me. Be good when Laravel Idea supports this, tho!

@tpetry
Copy link
Owner

tpetry commented Feb 16, 2024

@vatsake @boris-glumpler Are you using PhpStorm with Laravel Idea? In that case you could test the open Pull Request which should do a full integration with auto-suggestions and jump-to-code.

@vatsake
Copy link
Author

vatsake commented Feb 16, 2024

Nah, I'm using vscode.

@boris-glumpler
Copy link

Yup, I do. I've just finished a hike in a pretty remote part of Nepal, tho, and it'll take me 2-3 days to get back to my laptop. Will try it out then.

@boris-glumpler
Copy link

boris-glumpler commented Feb 21, 2024

Just tested it and it all seems to work really well!

@tpetry
Copy link
Owner

tpetry commented Feb 21, 2024

Ok, then I'll test on the weekend again.

@tpetry tpetry closed this as completed in 80066a2 Feb 26, 2024
@tpetry
Copy link
Owner

tpetry commented Feb 26, 2024

Autocomplete for PhpStorm with Laravel Idea plugin is now live with 0.35.0.

Other IDEs or PhpStorm without the plugin are not supported as there are no ways to do this currently. But I've requested the Laravel IDE helper package to make this possible in the future with a generic way: barryvdh/laravel-ide-helper#1529

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants