Okay, I have keyword completion working pretty well in my custom language plugin. It's even context-aware in a fairly simplisitc sense (class vs. trigger vs. inline query) in terms of the keywords that are presented. However, it still presents keywords that make no sense in a given location according to the grammar. I'm hoping there's some very simple way to ask the parser for the next token candidates based on its current position so I can filter appropriately. For example, if you requested completion in a Java source file at the following location:
public <cursor> class MyClass
you should only be presented with tokens for type modifiers, e.g., abstract, static, final, etc., and not flow control tokens such as if, for, while, etc. Ideally I'd be able to do this without having to replicate the grammar logic explicitly. Is this possible? Hopefully it's just some no-brainer option that I've overlooked!
Thanks in advance!