Code Completion Results being reset by IDE?
已回答
Hello,
I am developing code completion in my plugin.
The CompletionProvider is being called as expected, and LookupElements are added to the CompletionResultSet.
However, no results are displayed to the user.
I debugged the code completion process and found, that in CodeCompletionHandlerBase.completionFinished a list of LookupElements is retrieved from the indicator.
This happens after the code completion.
However, this list is somehow empty.
I have only one CompletionProvider yet, and can observe that LookupElements are added to the CompletionResultSet.
I know, that there are several other completion contributors provided by the IDE, but what are possible cases, that the list of LookupElements is cleared?
请先登录再写评论。
I found out, that the only setting where this problem occurs is the following, which is similar to for example static Java functions:
In both cases, I want code completion for the methodName.
Case 1: ClassName.<methodName>
Case 2: <methodName>
Case 2 is for imported methods as in Java.
Case 2 works fine, in Case 1 however I can observe, that the results are added to the CompletionResultSet, but not shown to the user.
The Psi structure is similar to the following:
Case 1:
MethodReference
ClassName
ID
‘.’
MethodName
ID
Case 2:
MethodReference
MethodName
ID
Grammar:
method_reference ::= (class_name ‘.’)? method_name
class_name ::= ID
method_name ::= ID
Hi,
The provided information is insufficient to tell what can be the reason. Please share at least your completion provider code. Full reproducible example, a test project and steps to reproduce the issue would be perfect, though.
Hi,
I tried to reproduce the problem but without success.
That's when I noticed, that the rule method_reference extends an QueryElement and implements PsiReference.
When commenting out the generation of this mixin, then the problem is gone.
I guess that there is some error with the resolve method.
However, that solved it, kind of.