plugin
plugin copied to clipboard
[Feature Request]: Ide.json : Have a way for "eloquentFields" to complete fields of relation
Feature Description
Hi !
I'm not sure if this is a feature request or a bug report.
I'm using the package Eloquent Power Joins to be able to simply sort a query by a field of a relation.
Without a configured ide.json, the method orderByPowerJoins() don't have any completion obviously.
With a configured ide.json like this one, I'm able to have a good completion of the fields of the current model and their relation.
{
"$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
"completions": [
{
"complete": "eloquentFields",
"options": {
"eloquentFields": {
"complete": "fieldsAndRelations"
}
},
"condition": [
{
"methodNames": [
"orderByPowerJoins"
]
}
]
}
]
}
However, it never show completion for the fields of the related model.
I tried every type of complete (fieldsAndRelations, deepRelations...) and the fields are never completed.
To clarify, here's what I'd like with a step by step exemple:
MyModel::query()->orderByPowerJoins('
^ trigger completion => show fields and relation of the current model
...
MyModel::query()->orderByPowerJoins('myRelation.
^ trigger completion => show **fields** and relation of the related model
Is there a way to accomplish this with the current complete types or does it need a new completion type like "complete": "deepFieldsAndRelations" ?
Thank you for you time and your amazing work! 😸
Hello, deepRelations works, but in usual with('') style. relation1.relation2:field1,field2. We will try to make it customizable in ide.json.
Okay, I confirm, when using the syntax to load specific column (the table:field syntax), the autocompletion works.
I'll use this syntax as a placeholder to get the completion and then change the : to a ., it's not perfect but it's better than nothing! 😄
It would be nice to have a way to enable it via the ide.json yes, I see a use with other function like ->pluck(relation.field)
Thanks!
Hi, we've implemented native support for this package. We will also improve ide.json completions in the next version.