[Custom Language][Complete] Question on complete after special characters

Answered

Hello I have a question regarding to the code completion in a custom language.

Basically our language has an extension extending com.intellij.codeInsight.completion.CompletionContributor . Now we found an issue in our complete. When people type `.`, our language do not have anything to complete, so CompletionResultSet is set to empty.

However, when people type `.F`, aka some char after the dot, IntelliJ does not call anything in CompletionContributor. Is it a bug in our IntelliJ API? Further, if I typed `.`(dot), and press UP and DOWN, then type a char, the complete works as normal.

For your information, our language is using the LSP protocol. See this impls for details. You may not assume we have language specific types of PSI elements.

2
3 comments

Hi,

What does it mean that IntelliJ does not call anything CompletionContributor? Do you mean the fillCompletionVariants() method, or all CompletionContributor's methods? Did you debug other methods? Does the problem occur only in your language or have you noticed it in others?

Please provide more details, ideally the plugin and test project code if possible.

0

> Do you mean the fillCompletionVariants() method,

I meant the method CompletionProvider::addCompletions().  Typically, when people try some character, I can see the statements in addCompletions is triggered. But the character after special character (dot) is not firing the addCompletions() method. So I doubt there may be something else I can set up to enforce the complete after the word `.F`. I believe this only happens in the our own language, which is installed via `lsp4intellij` plugin.

0

Hi,

I suggest checking if this condition:
https://github.com/ballerina-platform/lsp4intellij/blob/master/src/main/java/org/wso2/lsp4intellij/contributors/LSPCompletionContributor.java#L70

is true, because LSP completion seems to be called under this condition. If it's not true, then try to find the reason why the manager is null.

Sorry, but it's hard to help you more with so little information.

0

Please sign in to leave a comment.