Inserting code in grey (not as an annotation, and not as a popup)

Answered

Hi!

I'm investigating writing a plugin much like copilot (mostly for kicks and giggles).  i.e: tab based autocompletion, where completion a) happens automatically after pressing enter to go to a new line, and b) inserts directly at the current carat position, not as a completion popup nor as an annotation.

I'm reasonably certain I can used a filtered/debounced DocumentListener to do (a), but I'm not clear how I might “temporarily” insert “grey text” (which isn't syntax checked) into the current document.  Can someone point me in the right direction here? I have a feeling (not researched yet) that I'll be inserting some PSI element and then removing it if the user chooses not to complete.

 

0
1 comment

Hi,

Please see com.intellij.codeInsight.inline.completion.InlineCompletionProvider.

0

Please sign in to leave a comment.