-
Notifications
You must be signed in to change notification settings - Fork 38
IDE Builder and Blueprint completions with ide.json #73
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
Conversation
@adelf Its so awesome that the QueryBuilder methods finally work. Thanks! ❤️ But the use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Schema::table('users', function (Blueprint $table) {
// For $table->boolean('acl_admin') the initial() modifier is not suggested
// For $table->boolean('acl_admin')->initial(true) all following modifiers are not
// suggested anymore and code-inspect does not work
$table->boolean('acl_admin')
->initial(true)
->default(false);
// For $table->index(['acl_admin']) the where() modifier is not suggested
// For $table->index(['acl_admin'])->where('acl_admin = TRUE') all following modifiers are not
// suggested anymore and code-inspect does not work
$table->index(['acl_admin'])
->where('acl_admin = TRUE')
->algorithm('brin');
}); |
I extecuted that dozens of times. Together with the IDE helper re-generating all the stuff. I really don't understand how they interact with each other and what the correct sequence to call is. Or do I have to wait a few minutes after the ide.json update process?
I refactored it this way because then those new files are also helping PHPStan to know of these methods. I was able to remove some complex PHPStan extension code by that. |
I've now installed this PR directly instead of fiddling with the files directly and running manual update commands. Still only the query builder suggestions do work. I don't know what I am doing wrong as this would be the standard way for everyone installing the package. |
Sorry for the long response; I had a little vacation. Could you just reopen the project, Generate Helper code, and then take a look at vendor/_laravel_idea/_ide_helper_macro.php There should be namespace Illuminate\Database\Schema {
/**
* @mixin \Tpetry\PostgresqlEnhanced\Schema\Blueprint
*/
class Blueprint {}
/**
* @mixin \Tpetry\PostgresqlEnhanced\Schema\ColumnDefinition
*/
class ColumnDefinition {}
/**
* @mixin \Tpetry\PostgresqlEnhanced\Schema\IndexDefinition
*/
class IndexDefinition {}
} |
@adelf Its working - but very unreliable. I've deleted my project and recreated it and was presented with the blue PHP Storm bubble that I could run the Laravel Idea code generation. There I saw some progess bar working and everything works. But nothing happens when I am running the |
Hey. As promised, ide.json with new completions. I added only for Builder and Blueprint, maybe you will add some more.
It just adds
/** @mixin YourBuilder */ class DatabaseBuilder{}
during Laravwl Idea's Helper Code generationSo, PhpStorm will complete this class methods.
P.S. If you try to edit the ide.json file inside the vendor directory, Laravel Idea won't automatically load the changes. So, you will need to Laravel Idea Code Generation > Update ide.json metadata to load all changes:
It's only for your editing) users will fetch this file and all changes will be loaded automatically. They will need only to generate the helper file.