How to code semantic highlighting in VS Code Extension’s with custom language

I’m trying to setup a simple semantic highlighting script to automatically highlight already defined variable names but I can’t for the life of me figure it out. The VS Code docs are useless and it seems no one on the internet besides me has tried to do this in Javascript?

I just want to be able to understand the engine itself? The docs make no sense and have seemingly outdated code?