How to suppress the default code completion

Answered

I'm writing a CompletionContributor for our XML file. Only special attributes should be handled by this contributor. It works. But the problem is the other attributes still have default completions, so they keep suggesting user to reuse some text, which makes no sense for us. I'm trying to suppress all default code completions and let ours take the full control.

In my CompletionContributor I call the extend() with a loose filter: PlatformPatterns.psiElement() to catch the most cases. In my CompletionProvider I also make sure result.stopHere() will always be called at the end. But it doesn't help.

So I added a break point on CompletionContributor.fillCompletionVariants() and found out my CompletionContributor is triggered very late:

FilePathCompletionContributor, CustomFileTypeCompletionContributor, PostfixTemplateCompletionContributor, XmlNonFirstCompletionContributor, JavaMethodMergingContributor, my contributor.

The "order" property in the plugin.xml helps a little:

<completion.contributor language="XML" order="first" implementationClass="...my contributor class..."/>

The call order looks like this now:

LiveTemplateCompletionContributor, XmlCompletionContributor, my contributor.

But how can I suppress the LiveTemplateCompletionContributor and XmlCompletionContributor? 

Thanks!

 

0
2 comments
Official comment

You can change the order attribute to "first, before xml"

Avatar
Permanently deleted user

Thank you Peter! you helped me again. :) It works now.

I tried this, now my contributor is executed first:

order="first, before xml, before liveTemplates"

 

0

Please sign in to leave a comment.