CM6 equivalent for getLineTokens/getTokenAt


Still working on a migration to codemirror 6, I’m not sure of what to use to have a similar behavior to getLineTokens and getTokenAt. My understanding is I should use StringStream with StreamParser, but I don’t know exactly how (and StreamParser is an interface by the way, I don’t know where to find an implementation).

Your language mode will already have produced a parse tree. See syntaxTree and ensureSyntaxTree for access to the tree. It doesn’t work the same way as in CM5 (it’s not a flat list of tokens), but should provide information useful for similar situations.

Ok, I will have a look at these methods. Thanks!