GrammarKit standalone auto completion

Hi!

First of all thank you so much for your fantastic products, I converted already some people to IDEA and they won't be the last :)

I'm writing an editor for an expression language embedded in a JavaFX application. Until now we have an ANTLR4 grammar and some basic auto completion working on top of it.

I found GrammarKit recently and since your language editing is so smooth I'd like to give a try implementing this small language with it to see if we can develop more complex features.

The issue I've found is that GrammarKit is intended to be used primarly as a plugin in Intellij were all pieces fit together and you just have to create custom components to feed the framework with everything and the actual glue is kind of magic to me at the moment.

I'd like to first of all provide some token suggestions to the user but I don't know well how to start.

I've bundled already in the project psi-light-all.jar and grammarkit.jar but since it won't be a language plugin, I'm lost at the ParserDefinition.

Any pointer would be greatly appreciated.

Thanks!

1 comment
Comment actions Permalink

If you only want to provide completion but don't need a parser, you shouldn't use GrammarKit. Instead, you can directly implement CompletionContributor [1] and provide keyword suggestions as you need.

[1] https://upsource.jetbrains.com/ideac/file/HEAD/platform%2Flang-api%2Fsrc%2Fcom%2Fintellij%2FcodeInsight%2Fcompletion%2FCompletionContributor.java

This document should give you a better understanding of how language plugins work in general: http://confluence.jetbrains.com/display/IDEADEV/Developing+Custom+Language+Plugins+for+IntelliJ+IDEA

Note that there is currently no supported way to use an ANTLR grammar for an IntelliJ custom language plugin; most likely you'll need to reimplement your grammar either in GrammarKit or as a manually written parser.

0

Please sign in to leave a comment.