getTokenAt replacement for CM6


I’d like to get TreeNode object at a specified position, like getTokenAt in CM5.
I found that it can be accomplished like so:

const langState = state.field(Language.state)
console.log('node:', langState.tree.resolve(10))

But Language.state is not exposed as public: language/language.ts at main · codemirror/language · GitHub

Is there any official way to do that?

Ah, it’s duplicate: