diff options
author | Christian Clason <c.clason@uni-graz.at> | 2023-04-01 12:11:24 +0200 |
---|---|---|
committer | Christian Clason <c.clason@uni-graz.at> | 2023-04-01 12:19:15 +0200 |
commit | 90fdaf55c913d07bc80eec6442b02d8c001659b4 (patch) | |
tree | 6d6e18b4e84a227526a5c9551476686d387eba8e | |
parent | dee559d7440e3048790c6798bdb5ed89f8cdea30 (diff) | |
download | rneovim-90fdaf55c913d07bc80eec6442b02d8c001659b4.tar.gz rneovim-90fdaf55c913d07bc80eec6442b02d8c001659b4.tar.bz2 rneovim-90fdaf55c913d07bc80eec6442b02d8c001659b4.zip |
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.
-rw-r--r-- | runtime/doc/treesitter.txt | 2 | ||||
-rw-r--r-- | test/functional/treesitter/highlight_spec.lua | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 96021d6272..51098b9220 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -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* diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index 44e6500008..faeb4befcd 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -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) |