Contextual Autocomplete

If I wanted to implement an autocomplete that gave a different list of words based on a token in the line above and indentation of the current line which way should I approach it, through a Lezer grammar or as a LanguageSupport extension?


A grammar can be helpful to determine the syntactic position of the completion, but isn’t necessary (if a few regexps suffice, you can also use that). Autocompletion does have to be installed with some kind of extension, and will be separate from the grammar even with a Lezer grammar.