fix(completion): magic method names displayed inside argument list#2815
Conversation
|
I fixed this bug at work on #2622 but it turns to be independent on that PR and can be fixed separately. |
|
I caught it when made the recent fix for #2622 and fixed (0250c05#diff-2ba75b9069ec2e0eca8655a5fa214ecb0050bf8656e6c1842d2be83b91d31f27R93) but still cannot reproduce it here. |
|
That fix assumes that these two words make no sense inside Even if we found test data for that, let keep this PR as small as possible and fix that separately - I keep #2795 (comment) in mind. |
|
Yes, it's already better than before and I think this should be merged. But in this case it doesn't make sense to have a |
|
Thank you! I'll try to extract the function|const case fix too, assuming I'll have a reproducible test case. |
|
Note that this is all very unstable, adding one thing may break another as it's all just working around the parser being bad at invalid ASTs |
|
More, the logic needed to recognize the current context needs to be a bit hacky - at least I have no better ideas than some of uses in #2622 That's why we need more and more test cases. |
| return false; | ||
| } | ||
|
|
||
| if ($node->parent instanceof MethodDeclaration && $node->openBrace instanceof MissingToken) { |
There was a problem hiding this comment.
this causes lots of warnings:
[ERROR][2025-01-27 09:45:46] .../vim/lsp/rpc.lua:770 "rpc" "/home/daniel/.local/bin/phpactor" "stderr" "Warning: Undefined property: Microsoft\\PhpParser\\Node\\DelimitedList\\ParameterDeclarationList::$openBrace in /home/daniel/www/phpactor/phpactor/lib/Completion/Bridge/TolerantParser/CompletionContext.php on line 184\n"
[ERROR][2025-01-27 09:45:56] .../vim/lsp/rpc.lua:770 "rpc" "/home/daniel/.local/bin/phpactor" "stderr" "Warning: Undefined property: Microsoft\\PhpParser\\Node\\DelimitedList\\ParameterDeclarationList::$openBrace in /home/daniel/www/phpactor/phpactor/lib/Completion/Bridge/TolerantParser/CompletionContext.php on line 184\n"
[ERROR][2025-01-27 09:45:56] .../vim/lsp/rpc.lua:770 "rpc" "/home/daniel/.local/bin/phpactor" "stderr" "Warning: Undefined property: Microsoft\\PhpParser\\Node\\DelimitedList\\ParameterDeclarationList::$openBrace in /home/daniel/www/phpactor/phpactor/lib/Completion/Bridge/TolerantParser/CompletionContext.php on line 184\n"
There was a problem hiding this comment.
#2832 should precise the type of $node in that case.


No description provided.