Autocomplete suggestion at wrong caret position
Hi,
We are developing basic autocomplete feature for a custom language plugin.
The problem we are facing is that when user presses cmd+space, the autocompletion suggestions are displayed at the wrong caret position. (Refer attached screenshots).
Could you guys give any pointers on how to debug and fix this issue?
Screenshots:
1. User presses cmd + space after the word "\"hi\"", where the dark black bar could be seen.
2. The autocomplete suggestions are shown one line above.
Please sign in to leave a comment.
Which prefix is in CompletionResultSet.getPrefixMatcher().getPrefix() when you provide your completion variants in the completion contributor?
Hi Peter,
I am not sure if I got your question correctly. From what I understand, you are asking for the prefix value when we add a LookupElement to CompletionResultSet.
So, the prefix value while adding a LookupElement is "Say <[\w ]*>".
Just to set context, we have written a custom prefix matcher that does regex matching. The source code for the prefix matcher can be found here.
super(toRegexPrefix) call is invalid. PrefixMatcher.getPrefix should return the very same text that's in the editor. Lookup start offset is calculated based on this prefix length.
Thanks a lot Peter!
This fixes the issue.