How to create an inline completion that can be accepted on Tab


Hi all. I'm working on a IntelliJ plugin and trying to create an inline completion suggestion that gets generated after a shortcut. The functionality should very much resemble the one from the inline completion suggestion of the IntelliJ AI Assistant. I've been considering using the CompletionContributor endpoint but I can't make it work exactly as I need to since this doesn't directly generate the code in the editor. So to simplify: users uses a shortcut and in the editor appears suggested code that can be accepted or not. How to achieve that?

Thanks in advance :)


Hi Michał,

See com.intellij.codeInsight.inline.completion.InlineCompletionProvider.

You can find example implementations on IntelliJ Platform Explorer: