sublimelsp / LSP-clangd

C/C++ support for Sublime's LSP plugin provided through clangd.
MIT License
42 stars 1 forks source link

Feature Request: Custom semantic selectors for global & block scoped variables #33

Open AlexMax opened 2 weeks ago

AlexMax commented 2 weeks ago

There is a specific feature that I am taking advantage of in Visual Studio 2022 that I would very much like to replicate in Sublime Text.

In Visual C++ 2022, I have set up my color scheme to where block-scoped variables are red, class/struct member variables are light red, and global variables are white. With your plugin, I can get the proper color on class/struct members using the meta.semantic-token.property selector, but it does not appear that there is a more specific semantic selector than meta.semantic-token.variable for other types of variables.

Would it be possible to add a meta.semantic-token.variable.global and/or meta.semantic-token.variable.block selector?

LDAP commented 2 weeks ago

The semantic token types are defined by the LSP specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_semanticTokens

And the LSP plugin should support all of them. See https://lsp.sublimetext.io/customization/#semantic-highlighting

This plugin is a bridge to clangd where this need to be implemented. There is already an open issue for more semantic tokens: https://github.com/clangd/clangd/issues/1115