Skip to content

Instantly share code, notes, and snippets.

Customize lsp semantic token highlighting based on treesitter nodes/captures

The semantic tokens from lsp uses the @lsp.typemod.method.declaration highlight group for __init__ constructor of classes. Treesitter, in the other hand, applies the @constructor highlight group.

basedpyright-lsp

The @constructor highlight group is more meaningful, right?