Get grammar scopes / tokens in vscode extension

Viewed 390

Having defined TextMate grammar for text highlighting of a new language in Visual Studio Code, I'm now writing a DefinitionProvider. Is it possible to access the grammar tokens of the document in my extension code?

The signature of the extension method in a DefinitionProvider is:

provideDefinition(
    document: vscode.TextDocument,
    position: vscode.Position,
    token: vscode.CancellationToken,
  )

And I can't find a way to get any tokens from the document instance...

Any help is highly appreciated =)

EDIT: Let me rephrase that: Is it possible to use the already defined TextMate grammar to navigate the code in the extension code? I would like to not write a parser on my own...

1 Answers
Related