Adding extra symbols to Java auto complete

Hello,

Immediate problem

Can I get JAVA symbols in the autocomplete drop down box, that are not indexed as part of project creation? If so how?

Actual Problem

I want to load certain class files only when they are used (I plan to do this using a PsiTreeChangeListener and a custom vfs) in my plugin. I would like intellij to offer autocomplete suggestions even before the PsiTree is built for them. I want to provide autocompletion for these classes from some pre-computed data store.


Is this possible?

thanks
Siddharth

3 comments
Comment actions Permalink

Yes. Using the CompletionContributor API, you can add any completion variants in any context.

0
Comment actions Permalink

Thanks.

Next questions are

  1. What is a Pattern e.g. StringPattern
  2. I would ultimately want that I able to read text from a file and offer that in the autocomplete view
  3. I would then also like to auto add an import statement with the right package (which I will provide). I think if I am able to do 2, 3 is also possible.
0
Comment actions Permalink

A pattern specifies the context in which your completion contributor is triggered.

The IntelliJ IDEA API doesn't care where you get your completion variants from; it's entirely up to you.

You can specify an InsertHandler for an item provided by your completion contributor; it's a callback that gets called when an item is selected. You can use it to add import statements or perform any other modifications of the document.

0

Please sign in to leave a comment.