Accessing language autocompletion data

I have implemented a custom autocompletion function in codemirror 6 that builds a list of tokens from ViewUpdate change events, and uses said list of tokens for suggesting completions.

However, since the source of the tokens are from the document, I also want to leverage the list of existing keywords present in some of the codemirror language modes, such as

Since these keywords and snippets aren’t exported, I’m guessing the answer is no, and I’d have to duplicate some of it in my code. Is there another way?


Indeed, the keywords are usually encoded in the grammar, and not available in a useful way to outside code.

1 Like