Autocomplete suggestion at wrong caret position


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?


1. User presses cmd + space after the word "\"hi\"", where the dark black bar could be seen.
Screen Shot 2015-08-05 at 9.17.15 PM.png

2. The autocomplete suggestions are shown one line above.
Screen Shot 2015-08-05 at 9.17.50 PM.png

Comment actions Permalink

Which prefix is in CompletionResultSet.getPrefixMatcher().getPrefix() when you provide your completion variants in the completion contributor?

Comment actions Permalink

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.

Comment actions Permalink

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.

Comment actions Permalink

Thanks a lot Peter!
This fixes the issue.


Please sign in to leave a comment.