castwide / vscode-solargraph

A Visual Studio Code extension for Solargraph.
Other
425 stars 23 forks source link

Missing semantic tokenization #230

Open ddnexus opened 3 years ago

ddnexus commented 3 years ago

As stated in the VSCode Semantic Highlight Guide:

Semantic tokenization allows language servers to provide additional token information based on the language server's knowledge on how to resolve symbols in the context of a project.

Solargraph knows when a code entity is a variable or a method call, but the VSCode grammar does not. Indeed for the grammar my_method('my_param') is identified as an entity.name.function while my_method is identified as a variable because it has no parenthesis. That results in having the same method highlighted in 2 different ways, which is very confusing and annoying with ruby files in VSCode.

It looks like Solargraph is not adding the additional token that would allow the themes to distinguish variables from methods. Is that a bug or is that not yet implemented?

castwide commented 3 years ago

It's not yet implemented. Semantic tokens are a relatively new feature in LSP, and the Solargraph extension has never provided its own syntax highlighting. I'll look into adding this capability to the gem.

ddnexus commented 3 years ago

That would be great! Thank you!!!