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.
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

4 comments
Comment actions Permalink

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

0
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.

0
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.

0
Comment actions Permalink

Thanks a lot Peter!
This fixes the issue.

0

Please sign in to leave a comment.