VSCode does not give access to the built-in tokens.
Because the parser runs on the render thread and not the extension host thread.
You can instead use the same VSCode TextMate library to parse files and receive the tokens.
Otherwise you could use Web-Tree-Sitter.