fix(treesitter): revert to using iter_captures in highlighter

Fixes #27895
This commit is contained in:
Lewis Russell
2024-03-17 18:02:40 +00:00
committed by Lewis Russell
parent 77a9f3395b
commit 3b29b39e6d
4 changed files with 68 additions and 57 deletions

View File

@@ -762,6 +762,32 @@ describe('treesitter highlighting (C)', function()
]],
}
end)
it('gives higher priority to more specific captures #27895', function()
insert([[
void foo(int *bar);
]])
local query = [[
"*" @operator
(parameter_declaration
declarator: (pointer_declarator) @variable.parameter)
]]
exec_lua([[
local query = ...
vim.treesitter.query.set('c', 'highlights', query)
vim.treesitter.highlighter.new(vim.treesitter.get_parser(0, 'c'))
]], query)
screen:expect{grid=[[
void foo(int {4:*}{11:bar}); |
^ |
{1:~ }|*15
|
]]}
end)
end)
describe('treesitter highlighting (lua)', function()