Add typemod for decorators
Currently, lsp.type.decorator can be overwritten by a couple lsp tokens, for example @classmethod is overwritten by:
-
lsp.type.class -
lsp.mod.builtin -
lsp.mod.defaultLibrary -
lsp.typemod.class.builtin -
lsp.typemod.class.defaultLibrary
it would be nice to have something like lsp.mod.decorator, lsp.typemod.decorator.builtin or lsp.typemod.decorator.defaultLibrary so we can highlight decorators with the same colour regardless of if they're classes or functions
is mod and typemod a neovim-specific thing? i see it's mentioned here but i can't find anything about it in the LSP spec
happy to support it, tho i find it weird that semantic tokens are different in each editor
Literally have no idea whatsoever unfortunately
Looking at the documentation, typemod and mod just seem to be for semantic token modifiers with typemod being more specific (for example you might have @lsp.mod.decorator if you want to highlight all decorators a specific colour, and then @lsp.typemod.class.decorator and @lsp.typemod.function.decorator to distinguish between function and class decorators)
the spec also says you can just define whatever you want and that the predefined values are just the default "base", for example pyright (and rust-analyzer) also changes the in operators semantic token based on if it's used in a control flow or if it's used to check for membership, for example:
edit: however, for anyone using python in neovim you can add this to after/queries/python/highlights.scm to get similar behaviour
;; extends
(for_statement "in" @keyword.repeat)
(for_in_clause "in" @keyword.repeat)