mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
fix(tests): adapt treesitter/highlight_spec priority test
Still relied on the old `@Foo`->`Foo` capture to highlight mechanism; use capture with default highlight instead.
This commit is contained in:
parent
dee559d744
commit
90fdaf55c9
@ -440,7 +440,7 @@ higher than tree-sitter. It is also possible to change the priority of an
|
||||
individual query pattern manually by setting its `"priority"` metadata
|
||||
attribute: >
|
||||
|
||||
(super_important_node) @ImportantHighlight (#set! "priority" 105)
|
||||
((super_important_node) @superimportant (#set! "priority" 105))
|
||||
|
||||
==============================================================================
|
||||
TREESITTER LANGUAGE INJECTIONS *treesitter-language-injections*
|
||||
|
@ -575,14 +575,14 @@ describe('treesitter highlighting', function()
|
||||
|
||||
exec_lua [[
|
||||
local parser = vim.treesitter.get_parser(0, "c")
|
||||
test_hl = vim.treesitter.highlighter.new(parser, {queries = {c = hl_query..'\n((translation_unit) @Error (set! "priority" 101))\n'}})
|
||||
test_hl = vim.treesitter.highlighter.new(parser, {queries = {c = hl_query..'\n((translation_unit) @constant (#set! "priority" 101))\n'}})
|
||||
]]
|
||||
-- expect everything to have Error highlight
|
||||
-- expect everything to have Constant highlight
|
||||
screen:expect{grid=[[
|
||||
{12:int}{8: x = INT_MAX;} |
|
||||
{8:#define READ_STRING(x, y) (}{12:char_u}{8: *)read_string((x), (}{12:size_t}{8:)(y))}|
|
||||
{8:#define foo }{12:void}{8: main() { \} |
|
||||
{8: }{12:return}{8: 42; \} |
|
||||
{8:#define READ_STRING(x, y) (char_u *)read_string((x), (size_t)(y))}|
|
||||
{8:#define foo void main() { \} |
|
||||
{8: return 42; \} |
|
||||
{8: }} |
|
||||
^ |
|
||||
{1:~ }|
|
||||
@ -599,13 +599,13 @@ describe('treesitter highlighting', function()
|
||||
|
|
||||
]], attr_ids={
|
||||
[1] = {bold = true, foreground = Screen.colors.Blue1};
|
||||
[8] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red};
|
||||
[8] = {foreground = Screen.colors.Magenta1};
|
||||
-- bold will not be overwritten at the moment
|
||||
[12] = {background = Screen.colors.Red, bold = true, foreground = Screen.colors.Grey100};
|
||||
[12] = {bold = true, foreground = Screen.colors.Magenta1};
|
||||
}}
|
||||
|
||||
eq({
|
||||
{capture='Error', metadata = { priority='101' }, lang='c' };
|
||||
{capture='constant', metadata = { priority='101' }, lang='c' };
|
||||
{capture='type', metadata = { }, lang='c' };
|
||||
}, exec_lua [[ return vim.treesitter.get_captures_at_pos(0, 0, 2) ]])
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user