mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
fix(treesitter): revert to using iter_captures in highlighter
Fixes #27895
This commit is contained in:
committed by
Lewis Russell
parent
77a9f3395b
commit
3b29b39e6d
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user