mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
fix(lsp): add missing LSP semantic token highlight links
Added the following LSP semantic token types to be linked to highlight groups by default: * @lsp.type.event * @lsp.type.keyword * @lsp.type.modifier * @lsp.type.number * @lsp.type.operator * @lsp.type.regexp * @lsp.type.string
This commit is contained in:
committed by
Christian Clason
parent
ee89ba1d75
commit
542c910a1d
@ -460,13 +460,20 @@ The following groups are linked by default to standard |group-name|s:
|
|||||||
@lsp.type.decorator Function
|
@lsp.type.decorator Function
|
||||||
@lsp.type.enum Structure
|
@lsp.type.enum Structure
|
||||||
@lsp.type.enumMember Constant
|
@lsp.type.enumMember Constant
|
||||||
|
@lsp.type.event Type
|
||||||
@lsp.type.function Function
|
@lsp.type.function Function
|
||||||
@lsp.type.interface Structure
|
@lsp.type.interface Structure
|
||||||
|
@lsp.type.keyword Keyword
|
||||||
@lsp.type.macro Macro
|
@lsp.type.macro Macro
|
||||||
@lsp.type.method Function
|
@lsp.type.method Function
|
||||||
|
@lsp.type.modifier Type
|
||||||
@lsp.type.namespace Structure
|
@lsp.type.namespace Structure
|
||||||
|
@lsp.type.number Number
|
||||||
|
@lsp.type.operator Operator
|
||||||
@lsp.type.parameter Identifier
|
@lsp.type.parameter Identifier
|
||||||
@lsp.type.property Identifier
|
@lsp.type.property Identifier
|
||||||
|
@lsp.type.regexp SpecialChar
|
||||||
|
@lsp.type.string String
|
||||||
@lsp.type.struct Structure
|
@lsp.type.struct Structure
|
||||||
@lsp.type.type Type
|
@lsp.type.type Type
|
||||||
@lsp.type.typeParameter TypeDef
|
@lsp.type.typeParameter TypeDef
|
||||||
|
@ -290,13 +290,20 @@ static const char *highlight_init_both[] = {
|
|||||||
"default link @lsp.type.decorator @attribute",
|
"default link @lsp.type.decorator @attribute",
|
||||||
"default link @lsp.type.enum @type",
|
"default link @lsp.type.enum @type",
|
||||||
"default link @lsp.type.enumMember @constant",
|
"default link @lsp.type.enumMember @constant",
|
||||||
|
"default link @lsp.type.event @type",
|
||||||
"default link @lsp.type.function @function",
|
"default link @lsp.type.function @function",
|
||||||
"default link @lsp.type.interface @type",
|
"default link @lsp.type.interface @type",
|
||||||
|
"default link @lsp.type.keyword @keyword",
|
||||||
"default link @lsp.type.macro @constant.macro",
|
"default link @lsp.type.macro @constant.macro",
|
||||||
"default link @lsp.type.method @function.method",
|
"default link @lsp.type.method @function.method",
|
||||||
|
"default link @lsp.type.modifier @type.qualifier",
|
||||||
"default link @lsp.type.namespace @module",
|
"default link @lsp.type.namespace @module",
|
||||||
|
"default link @lsp.type.number @number",
|
||||||
|
"default link @lsp.type.operator @operator",
|
||||||
"default link @lsp.type.parameter @variable.parameter",
|
"default link @lsp.type.parameter @variable.parameter",
|
||||||
"default link @lsp.type.property @property",
|
"default link @lsp.type.property @property",
|
||||||
|
"default link @lsp.type.regexp @string.regexp",
|
||||||
|
"default link @lsp.type.string @string",
|
||||||
"default link @lsp.type.struct @type",
|
"default link @lsp.type.struct @type",
|
||||||
"default link @lsp.type.type @type",
|
"default link @lsp.type.type @type",
|
||||||
"default link @lsp.type.typeParameter @type.definition",
|
"default link @lsp.type.typeParameter @type.definition",
|
||||||
|
@ -37,6 +37,8 @@ describe('semantic token highlighting', function()
|
|||||||
[7] = { bold = true, foreground = Screen.colors.DarkCyan },
|
[7] = { bold = true, foreground = Screen.colors.DarkCyan },
|
||||||
[8] = { bold = true, foreground = Screen.colors.SlateBlue },
|
[8] = { bold = true, foreground = Screen.colors.SlateBlue },
|
||||||
[9] = { bold = true, foreground = tonumber('0x6a0dad') },
|
[9] = { bold = true, foreground = tonumber('0x6a0dad') },
|
||||||
|
[10] = { bold = true, foreground = Screen.colors.Brown },
|
||||||
|
[11] = { foreground = Screen.colors.Magenta1 },
|
||||||
}
|
}
|
||||||
command([[ hi link @lsp.type.namespace Type ]])
|
command([[ hi link @lsp.type.namespace Type ]])
|
||||||
command([[ hi link @lsp.type.function Special ]])
|
command([[ hi link @lsp.type.function Special ]])
|
||||||
@ -837,11 +839,13 @@ b = "as"]],
|
|||||||
{
|
{
|
||||||
it = 'rust-analyzer',
|
it = 'rust-analyzer',
|
||||||
text = [[pub fn main() {
|
text = [[pub fn main() {
|
||||||
break rust;
|
println!("Hello world!");
|
||||||
/// what?
|
break rust;
|
||||||
|
/// what?
|
||||||
}
|
}
|
||||||
]],
|
]],
|
||||||
response = [[{"data": [0, 0, 3, 1, 0, 0, 4, 2, 1, 0, 0, 3, 4, 14, 524290, 0, 4, 1, 45, 0, 0, 1, 1, 45, 0, 0, 2, 1, 26, 0, 1, 4, 5, 1, 8192, 0, 6, 4, 52, 0, 0, 4, 1, 48, 0, 1, 4, 9, 0, 1, 1, 0, 1, 26, 0], "resultId": "1"}]],
|
response = [[{"data": [0, 0, 3, 1, 0, 0, 4, 2, 1, 0, 0, 3, 4, 14, 524290, 0, 4, 1, 45, 0, 0, 1, 1, 45, 0, 0, 2, 1, 26, 0, 1, 4, 8, 17, 0, 0, 8, 1, 45, 0, 0, 1, 14, 2, 0, 0, 14, 1, 45, 0, 0, 1, 1, 48, 0, 1, 4, 5, 1, 8192, 0, 6, 4, 52, 0, 0, 4, 1, 48, 0, 1, 4, 9, 0, 1, 1, 0, 1, 26, 0 ], "resultId": "1"}]],
|
||||||
|
|
||||||
legend = [[{
|
legend = [[{
|
||||||
"tokenTypes": [
|
"tokenTypes": [
|
||||||
"comment", "keyword", "string", "number", "regexp", "operator", "namespace", "type", "struct", "class", "interface", "enum", "enumMember", "typeParameter", "function", "method", "property", "macro", "variable",
|
"comment", "keyword", "string", "number", "regexp", "operator", "namespace", "type", "struct", "class", "interface", "enum", "enumMember", "typeParameter", "function", "method", "property", "macro", "variable",
|
||||||
@ -904,6 +908,46 @@ b = "as"]],
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
line = 1,
|
line = 1,
|
||||||
|
modifiers = {},
|
||||||
|
start_col = 4,
|
||||||
|
end_col = 12,
|
||||||
|
type = 'macro', -- println!
|
||||||
|
marked = true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
line = 1,
|
||||||
|
modifiers = {},
|
||||||
|
start_col = 12,
|
||||||
|
end_col = 13,
|
||||||
|
type = 'parenthesis',
|
||||||
|
marked = true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
line = 1,
|
||||||
|
modifiers = {},
|
||||||
|
start_col = 13,
|
||||||
|
end_col = 27,
|
||||||
|
type = 'string', -- "Hello world!"
|
||||||
|
marked = true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
line = 1,
|
||||||
|
modifiers = {},
|
||||||
|
start_col = 27,
|
||||||
|
end_col = 28,
|
||||||
|
type = 'parenthesis',
|
||||||
|
marked = true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
line = 1,
|
||||||
|
modifiers = {},
|
||||||
|
start_col = 28,
|
||||||
|
end_col = 29,
|
||||||
|
type = 'semicolon',
|
||||||
|
marked = true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
line = 2,
|
||||||
modifiers = { controlFlow = true },
|
modifiers = { controlFlow = true },
|
||||||
start_col = 4,
|
start_col = 4,
|
||||||
end_col = 9, -- break
|
end_col = 9, -- break
|
||||||
@ -911,31 +955,31 @@ b = "as"]],
|
|||||||
marked = true,
|
marked = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
line = 1,
|
line = 2,
|
||||||
modifiers = {},
|
modifiers = {},
|
||||||
start_col = 10,
|
start_col = 10,
|
||||||
end_col = 13, -- rust
|
end_col = 14, -- rust
|
||||||
type = 'unresolvedReference',
|
type = 'unresolvedReference',
|
||||||
marked = true,
|
marked = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
line = 1,
|
line = 2,
|
||||||
modifiers = {},
|
modifiers = {},
|
||||||
start_col = 13,
|
start_col = 14,
|
||||||
end_col = 13,
|
end_col = 15,
|
||||||
type = 'semicolon',
|
type = 'semicolon',
|
||||||
marked = true,
|
marked = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
line = 2,
|
line = 3,
|
||||||
modifiers = { documentation = true },
|
modifiers = { documentation = true },
|
||||||
start_col = 4,
|
start_col = 4,
|
||||||
end_col = 11,
|
end_col = 13,
|
||||||
type = 'comment', -- /// what?
|
type = 'comment', -- /// what?
|
||||||
marked = true,
|
marked = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
line = 3,
|
line = 4,
|
||||||
modifiers = {},
|
modifiers = {},
|
||||||
start_col = 0,
|
start_col = 0,
|
||||||
end_col = 1,
|
end_col = 1,
|
||||||
@ -946,12 +990,13 @@ b = "as"]],
|
|||||||
expected_screen = function()
|
expected_screen = function()
|
||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
pub fn {8:main}() { |
|
{10:pub} {10:fn} {8:main}() { |
|
||||||
break rust; |
|
{5:println!}({11:"Hello world!"}); |
|
||||||
//{6:/ what?} |
|
{10:break} rust; |
|
||||||
|
{6:/// what?} |
|
||||||
} |
|
} |
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|*10
|
{1:~ }|*9
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user