Keeping completion list open on an exact single match

I'm trying to write a "MathSymbolCompletionContributor" that gets a triggered autopop when someone types a '\'. This works so far. The problem is when I type in a short command like "AA" the completion box goes away before  tab can be pressed (which of course inserts the symbol---see attached photo)

do I need to change something in my completion contributor class to fix this? Is it simply a change to the prefix matcher or is it something else--It seems like there ought to be a flag somewhere that controls this behavior. I've read the extensive comments in CompletionContributor.java and have explored some things in there to no avail.

I noticed too that live template completions seem to have the behavior I want (meaning the box doesn't disappear when I type the whole command--even when there is only a single result listed) but was unable to figure out what controls this in LiveTemplateCompletionContributor. 

Any ideas?

2 comments
Comment actions Permalink
Official comment

Please see LookupElement#isWorthShowingInAutoPopup. You can either override it, or make it return true by adding some information to the lookup element presentation.

Comment actions Permalink

Thanks! That worked nicely. I just added one blank character to the lookup element presentation's tail-text. This ultimately seemed easier than subclassing and I don't see any observable downside.

0

Please sign in to leave a comment.