neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 90fdaf55c913d07bc80eec6442b02d8c001659b4
parent dee559d7440e3048790c6798bdb5ed89f8cdea30
Author: Christian Clason <c.clason@uni-graz.at>
Date:   Sat,  1 Apr 2023 12:11:24 +0200

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.

Diffstat:
Mruntime/doc/treesitter.txt | 2+-
Mtest/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 @@ -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 @@ -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)