klesun/deep-assoc-completion

Support argumentsSet as array value in phpstorm.meta

tminich opened this issue · 5 comments

Not sure how reasonable/feasible this is, but would it be possible to support argumentsSet as argument values in definitions in phpstorm.meta?

Example:

    expectedArguments(\Response::askUser(), 1, [
        'title' => argumentsSet('laravel-translation-keys'),
    ]);

(The set being defined earlier)
This should give me completion after typing \Response::askUser('first argument', ['title' => <here>]).

Hm... it was long ago, but I think at least locally argumentsSet() were supposed to work. I could take a look when I'll get to the project next time, but that most likely won't be soon. Possibly a PR would be a more hopeful option.

It probably would be somewhere around here:

And here are some relevant tests:
https://github.com/klesun-misc/deep-assoc-lsp-tests/blob/3ed6c720dc464ff4d6d62509094a5fba61eeca6f/testFixture/phpstorm_tests/meta/.phpstorm.meta.php#L84

Also this may be relevant to your request:
#75 (comment)

Maybe that's the issue. Possibly there is a different way to achieve what I want, my luck with being able to work on IntelliJ IDE plugins has been bad so far and ended in version hell XD
The argument set I need to reference is just a list of strings, so maybe there is a way to set the array argument in a way the plugin recognizes the value should come from that list?

Maybe try:

    expectedArguments(\Response::askUser(), 1, [
        'title' => 'stringA' ?: 'stringB' ?: 'stringC',
    ]);

If I remember right the value of the array passed to expectedArguments() is just passed as a string to the plugin, and I just parse it the same way I do comments.

Works, thanks a lot :)