diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2025-02-05 23:09:29 +0000 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2025-02-05 23:09:29 +0000 |
| commit | d5f194ce780c95821a855aca3c19426576d28ae0 (patch) | |
| tree | d45f461b19f9118ad2bb1f440a7a08973ad18832 /test/functional/treesitter/highlight_spec.lua | |
| parent | c5d770d311841ea5230426cc4c868e8db27300a8 (diff) | |
| parent | 44740e561fc93afe3ebecfd3618bda2d2abeafb0 (diff) | |
| download | rneovim-rahm.tar.gz rneovim-rahm.tar.bz2 rneovim-rahm.zip | |
Diffstat (limited to 'test/functional/treesitter/highlight_spec.lua')
| -rw-r--r-- | test/functional/treesitter/highlight_spec.lua | 823 |
1 files changed, 406 insertions, 417 deletions
diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index 5c6be869c6..7f0a3cb342 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -12,6 +12,7 @@ local fn = n.fn local eq = t.eq local hl_query_c = [[ + ; query (ERROR) @error "if" @keyword @@ -65,40 +66,40 @@ static int nlua_schedule(lua_State *const lstate) }]] local hl_grid_legacy_c = [[ - {2:^/// Schedule Lua callback on main loop's event queue} | - {3:static} {3:int} nlua_schedule(lua_State *{3:const} lstate) | + {18:^/// Schedule Lua callback on main loop's event queue} | + {6:static} {6:int} nlua_schedule(lua_State *{6:const} lstate) | { | - {4:if} (lua_type(lstate, {5:1}) != LUA_TFUNCTION | + {15:if} (lua_type(lstate, {26:1}) != LUA_TFUNCTION | || lstate != lstate) { | - lua_pushliteral(lstate, {5:"vim.schedule: expected function"}); | - {4:return} lua_error(lstate); | + lua_pushliteral(lstate, {26:"vim.schedule: expected function"}); | + {15:return} lua_error(lstate); | } | | - LuaRef cb = nlua_ref(lstate, {5:1}); | + LuaRef cb = nlua_ref(lstate, {26:1}); | | multiqueue_put(main_loop.events, nlua_schedule_event, | - {5:1}, ({3:void} *)({3:ptrdiff_t})cb); | - {4:return} {5:0}; | + {26:1}, ({6:void} *)({6:ptrdiff_t})cb); | + {15:return} {26:0}; | } | {1:~ }|*2 | ]] local hl_grid_ts_c = [[ - {2:^/// Schedule Lua callback on main loop's event queue} | - {3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) | + {18:^/// Schedule Lua callback on main loop's event queue} | + {6:static} {6:int} {25:nlua_schedule}({6:lua_State} *{6:const} lstate) | { | - {4:if} ({11:lua_type}(lstate, {5:1}) != {5:LUA_TFUNCTION} | - || {6:lstate} != {6:lstate}) { | - {11:lua_pushliteral}(lstate, {5:"vim.schedule: expected function"}); | - {4:return} {11:lua_error}(lstate); | + {15:if} ({25:lua_type}(lstate, {26:1}) != {26:LUA_TFUNCTION} | + || {19:lstate} != {19:lstate}) { | + {25:lua_pushliteral}(lstate, {26:"vim.schedule: expected function"}); | + {15:return} {25:lua_error}(lstate); | } | | - {7:LuaRef} cb = {11:nlua_ref}(lstate, {5:1}); | + {29:LuaRef} cb = {25:nlua_ref}(lstate, {26:1}); | | - multiqueue_put(main_loop.events, {11:nlua_schedule_event}, | - {5:1}, ({3:void} *)({3:ptrdiff_t})cb); | - {4:return} {5:0}; | + multiqueue_put(main_loop.events, {25:nlua_schedule_event}, | + {26:1}, ({6:void} *)({6:ptrdiff_t})cb); | + {15:return} {26:0}; | } | {1:~ }|*2 | @@ -145,10 +146,10 @@ local injection_grid_c = [[ ]] local injection_grid_expected_c = [[ - {3:int} x = {5:INT_MAX}; | - #define {5:READ_STRING}(x, y) ({3:char} *)read_string((x), ({3:size_t})(y)) | - #define foo {3:void} main() { \ | - {4:return} {5:42}; \ | + {6:int} x = {26:INT_MAX}; | + #define {26:READ_STRING}(x, y) ({6:char} *)read_string((x), ({6:size_t})(y)) | + #define foo {6:void} main() { \ | + {15:return} {26:42}; \ | } | ^ | {1:~ }|*11 @@ -161,20 +162,6 @@ describe('treesitter highlighting (C)', function() before_each(function() clear() screen = Screen.new(65, 18) - screen:set_default_attr_ids { - [1] = { bold = true, foreground = Screen.colors.Blue1 }, - [2] = { foreground = Screen.colors.Blue1 }, - [3] = { bold = true, foreground = Screen.colors.SeaGreen4 }, - [4] = { bold = true, foreground = Screen.colors.Brown }, - [5] = { foreground = Screen.colors.Magenta }, - [6] = { foreground = Screen.colors.Red }, - [7] = { bold = true, foreground = Screen.colors.SlateBlue }, - [8] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red }, - [9] = { foreground = Screen.colors.Magenta, background = Screen.colors.Red }, - [10] = { foreground = Screen.colors.Red, background = Screen.colors.Red }, - [11] = { foreground = Screen.colors.Cyan4 }, - } - command [[ hi link @error ErrorMsg ]] command [[ hi link @warning WarningMsg ]] end) @@ -246,124 +233,124 @@ describe('treesitter highlighting (C)', function() feed('5Goc<esc>dd') - screen:expect { + screen:expect({ grid = [[ - {2:/// Schedule Lua callback on main loop's event queue} | - {3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) | - { | - {4:if} ({11:lua_type}(lstate, {5:1}) != {5:LUA_TFUNCTION} | - || {6:lstate} != {6:lstate}) { | - {11:^lua_pushliteral}(lstate, {5:"vim.schedule: expected function"}); | - {4:return} {11:lua_error}(lstate); | - } | - | - {7:LuaRef} cb = {11:nlua_ref}(lstate, {5:1}); | - | - multiqueue_put(main_loop.events, {11:nlua_schedule_event}, | - {5:1}, ({3:void} *)({3:ptrdiff_t})cb); | - {4:return} {5:0}; | - } | - {1:~ }|*2 - | - ]], - } + {18:/// Schedule Lua callback on main loop's event queue} | + {6:static} {6:int} {25:nlua_schedule}({6:lua_State} *{6:const} lstate) | + { | + {15:if} ({25:lua_type}(lstate, {26:1}) != {26:LUA_TFUNCTION} | + || {19:lstate} != {19:lstate}) { | + {25:^lua_pushliteral}(lstate, {26:"vim.schedule: expected function"}); | + {15:return} {25:lua_error}(lstate); | + } | + | + {29:LuaRef} cb = {25:nlua_ref}(lstate, {26:1}); | + | + multiqueue_put(main_loop.events, {25:nlua_schedule_event}, | + {26:1}, ({6:void} *)({6:ptrdiff_t})cb); | + {15:return} {26:0}; | + } | + {1:~ }|*2 + | + ]], + }) feed('7Go*/<esc>') - screen:expect { + screen:expect({ grid = [[ - {2:/// Schedule Lua callback on main loop's event queue} | - {3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) | - { | - {4:if} ({11:lua_type}(lstate, {5:1}) != {5:LUA_TFUNCTION} | - || {6:lstate} != {6:lstate}) { | - {11:lua_pushliteral}(lstate, {5:"vim.schedule: expected function"}); | - {4:return} {11:lua_error}(lstate); | - {8:*^/} | - } | - | - {7:LuaRef} cb = {11:nlua_ref}(lstate, {5:1}); | - | - multiqueue_put(main_loop.events, {11:nlua_schedule_event}, | - {5:1}, ({3:void} *)({3:ptrdiff_t})cb); | - {4:return} {5:0}; | - } | - {1:~ }| - | - ]], - } + {18:/// Schedule Lua callback on main loop's event queue} | + {6:static} {6:int} {25:nlua_schedule}({6:lua_State} *{6:const} lstate) | + { | + {15:if} ({25:lua_type}(lstate, {26:1}) != {26:LUA_TFUNCTION} | + || {19:lstate} != {19:lstate}) { | + {25:lua_pushliteral}(lstate, {26:"vim.schedule: expected function"}); | + {15:return} {25:lua_error}(lstate); | + {9:*^/} | + } | + | + {29:LuaRef} cb = {25:nlua_ref}(lstate, {26:1}); | + | + multiqueue_put(main_loop.events, {25:nlua_schedule_event}, | + {26:1}, ({6:void} *)({6:ptrdiff_t})cb); | + {15:return} {26:0}; | + } | + {1:~ }| + | + ]], + }) feed('3Go/*<esc>') - screen:expect { + screen:expect({ grid = [[ - {2:/// Schedule Lua callback on main loop's event queue} | - {3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) | - { | - {2:/^*} | - {2: if (lua_type(lstate, 1) != LUA_TFUNCTION} | - {2: || lstate != lstate) {} | - {2: lua_pushliteral(lstate, "vim.schedule: expected function");} | - {2: return lua_error(lstate);} | - {2:*/} | - } | - | - {7:LuaRef} cb = {11:nlua_ref}(lstate, {5:1}); | - | - multiqueue_put(main_loop.events, {11:nlua_schedule_event}, | - {5:1}, ({3:void} *)({3:ptrdiff_t})cb); | - {4:return} {5:0}; | - {8:}} | - | - ]], - } + {18:/// Schedule Lua callback on main loop's event queue} | + {6:static} {6:int} {25:nlua_schedule}({6:lua_State} *{6:const} lstate) | + { | + {18:/^*} | + {18: if (lua_type(lstate, 1) != LUA_TFUNCTION} | + {18: || lstate != lstate) {} | + {18: lua_pushliteral(lstate, "vim.schedule: expected function");} | + {18: return lua_error(lstate);} | + {18:*/} | + } | + | + {29:LuaRef} cb = {25:nlua_ref}(lstate, {26:1}); | + | + multiqueue_put(main_loop.events, {25:nlua_schedule_event}, | + {26:1}, ({6:void} *)({6:ptrdiff_t})cb); | + {15:return} {26:0}; | + {9:}} | + | + ]], + }) feed('gg$') feed('~') - screen:expect { + screen:expect({ grid = [[ - {2:/// Schedule Lua callback on main loop's event queu^E} | - {3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) | - { | - {2:/*} | - {2: if (lua_type(lstate, 1) != LUA_TFUNCTION} | - {2: || lstate != lstate) {} | - {2: lua_pushliteral(lstate, "vim.schedule: expected function");} | - {2: return lua_error(lstate);} | - {2:*/} | - } | - | - {7:LuaRef} cb = {11:nlua_ref}(lstate, {5:1}); | - | - multiqueue_put(main_loop.events, {11:nlua_schedule_event}, | - {5:1}, ({3:void} *)({3:ptrdiff_t})cb); | - {4:return} {5:0}; | - {8:}} | - | - ]], - } + {18:/// Schedule Lua callback on main loop's event queu^E} | + {6:static} {6:int} {25:nlua_schedule}({6:lua_State} *{6:const} lstate) | + { | + {18:/*} | + {18: if (lua_type(lstate, 1) != LUA_TFUNCTION} | + {18: || lstate != lstate) {} | + {18: lua_pushliteral(lstate, "vim.schedule: expected function");} | + {18: return lua_error(lstate);} | + {18:*/} | + } | + | + {29:LuaRef} cb = {25:nlua_ref}(lstate, {26:1}); | + | + multiqueue_put(main_loop.events, {25:nlua_schedule_event}, | + {26:1}, ({6:void} *)({6:ptrdiff_t})cb); | + {15:return} {26:0}; | + {9:}} | + | + ]], + }) feed('re') - screen:expect { + screen:expect({ grid = [[ - {2:/// Schedule Lua callback on main loop's event queu^e} | - {3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) | - { | - {2:/*} | - {2: if (lua_type(lstate, 1) != LUA_TFUNCTION} | - {2: || lstate != lstate) {} | - {2: lua_pushliteral(lstate, "vim.schedule: expected function");} | - {2: return lua_error(lstate);} | - {2:*/} | - } | - | - {7:LuaRef} cb = {11:nlua_ref}(lstate, {5:1}); | - | - multiqueue_put(main_loop.events, {11:nlua_schedule_event}, | - {5:1}, ({3:void} *)({3:ptrdiff_t})cb); | - {4:return} {5:0}; | - {8:}} | - | - ]], - } + {18:/// Schedule Lua callback on main loop's event queu^e} | + {6:static} {6:int} {25:nlua_schedule}({6:lua_State} *{6:const} lstate) | + { | + {18:/*} | + {18: if (lua_type(lstate, 1) != LUA_TFUNCTION} | + {18: || lstate != lstate) {} | + {18: lua_pushliteral(lstate, "vim.schedule: expected function");} | + {18: return lua_error(lstate);} | + {18:*/} | + } | + | + {29:LuaRef} cb = {25:nlua_ref}(lstate, {26:1}); | + | + multiqueue_put(main_loop.events, {25:nlua_schedule_event}, | + {26:1}, ({6:void} *)({6:ptrdiff_t})cb); | + {15:return} {26:0}; | + {9:}} | + | + ]], + }) end) it('is updated with :sort', function() @@ -372,83 +359,79 @@ describe('treesitter highlighting (C)', function() local parser = vim.treesitter.get_parser(0, 'c') vim.treesitter.highlighter.new(parser, { queries = { c = hl_query_c } }) end) - screen:expect { + screen:expect({ grid = [[ - {3:int} width = {5:INT_MAX}, height = {5:INT_MAX}; | - {3:bool} ext_widgets[kUIExtCount]; | - {4:for} ({3:UIExtension} i = {5:0}; ({3:int})i < kUIExtCount; i++) { | - ext_widgets[i] = true; | - } | - | - {3:bool} inclusive = ui_override(); | - {4:for} ({3:size_t} i = {5:0}; i < ui_count; i++) { | - {3:UI} *ui = uis[i]; | - width = {5:MIN}(ui->width, width); | - height = {5:MIN}(ui->height, height); | - foo = {5:BAR}(ui->bazaar, bazaar); | - {4:for} ({3:UIExtension} j = {5:0}; ({3:int})j < kUIExtCount; j++) { | - ext_widgets[j] &= (ui->ui_ext[j] || inclusive); | - } | - } | - ^} | - | - ]], - } + {6:int} width = {26:INT_MAX}, height = {26:INT_MAX}; | + {6:bool} ext_widgets[kUIExtCount]; | + {15:for} ({6:UIExtension} i = {26:0}; ({6:int})i < kUIExtCount; i++) { | + ext_widgets[i] = true; | + } | + | + {6:bool} inclusive = ui_override(); | + {15:for} ({6:size_t} i = {26:0}; i < ui_count; i++) { | + {6:UI} *ui = uis[i]; | + width = {26:MIN}(ui->width, width); | + height = {26:MIN}(ui->height, height); | + foo = {26:BAR}(ui->bazaar, bazaar); | + {15:for} ({6:UIExtension} j = {26:0}; ({6:int})j < kUIExtCount; j++) { | + ext_widgets[j] &= (ui->ui_ext[j] || inclusive); | + } | + } | + ^} | + | + ]], + }) feed ':sort<cr>' - screen:expect { + screen:expect({ grid = [[ - ^ | - ext_widgets[j] &= (ui->ui_ext[j] || inclusive); | - {3:UI} *ui = uis[i]; | - ext_widgets[i] = true; | - foo = {5:BAR}(ui->bazaar, bazaar); | - {4:for} ({3:UIExtension} j = {5:0}; ({3:int})j < kUIExtCount; j++) { | - height = {5:MIN}(ui->height, height); | - width = {5:MIN}(ui->width, width); | - } | - {3:bool} ext_widgets[kUIExtCount]; | - {3:bool} inclusive = ui_override(); | - {4:for} ({3:UIExtension} i = {5:0}; ({3:int})i < kUIExtCount; i++) { | - {4:for} ({3:size_t} i = {5:0}; i < ui_count; i++) { | - {3:int} width = {5:INT_MAX}, height = {5:INT_MAX}; | - } |*2 - {3:void} ui_refresh({3:void}) | - :sort | - ]], - } + ^ | + ext_widgets[j] &= (ui->ui_ext[j] || inclusive); | + {6:UI} *ui = uis[i]; | + ext_widgets[i] = true; | + foo = {26:BAR}(ui->bazaar, bazaar); | + {15:for} ({6:UIExtension} j = {26:0}; ({6:int})j < kUIExtCount; j++) { | + height = {26:MIN}(ui->height, height); | + width = {26:MIN}(ui->width, width); | + } | + {6:bool} ext_widgets[kUIExtCount]; | + {6:bool} inclusive = ui_override(); | + {15:for} ({6:UIExtension} i = {26:0}; ({6:int})i < kUIExtCount; i++) { | + {15:for} ({6:size_t} i = {26:0}; i < ui_count; i++) { | + {6:int} width = {26:INT_MAX}, height = {26:INT_MAX}; | + } |*2 + {6:void} ui_refresh({6:void}) | + :sort | + ]], + }) - feed 'u' + feed 'u:<esc>' - screen:expect { + screen:expect({ grid = [[ - {3:int} width = {5:INT_MAX}, height = {5:INT_MAX}; | - {3:bool} ext_widgets[kUIExtCount]; | - {4:for} ({3:UIExtension} i = {5:0}; ({3:int})i < kUIExtCount; i++) { | - ext_widgets[i] = true; | - } | - | - {3:bool} inclusive = ui_override(); | - {4:for} ({3:size_t} i = {5:0}; i < ui_count; i++) { | - {3:UI} *ui = uis[i]; | - width = {5:MIN}(ui->width, width); | - height = {5:MIN}(ui->height, height); | - foo = {5:BAR}(ui->bazaar, bazaar); | - {4:for} ({3:UIExtension} j = {5:0}; ({3:int})j < kUIExtCount; j++) { | - ext_widgets[j] &= (ui->ui_ext[j] || inclusive); | - } | - } | - ^} | - 19 changes; before #2 {MATCH:.*}| - ]], - } + {6:int} width = {26:INT_MAX}, height = {26:INT_MAX}; | + {6:bool} ext_widgets[kUIExtCount]; | + {15:for} ({6:UIExtension} i = {26:0}; ({6:int})i < kUIExtCount; i++) { | + ext_widgets[i] = true; | + } | + | + {6:bool} inclusive = ui_override(); | + {15:for} ({6:size_t} i = {26:0}; i < ui_count; i++) { | + {6:UI} *ui = uis[i]; | + width = {26:MIN}(ui->width, width); | + height = {26:MIN}(ui->height, height); | + foo = {26:BAR}(ui->bazaar, bazaar); | + {15:for} ({6:UIExtension} j = {26:0}; ({6:int})j < kUIExtCount; j++) { | + ext_widgets[j] &= (ui->ui_ext[j] || inclusive); | + } | + } | + ^} | + | + ]], + }) end) it('supports with custom parser', function() - screen:set_default_attr_ids { - [1] = { bold = true, foreground = Screen.colors.SeaGreen4 }, - } - insert(test_text_c) screen:expect { @@ -488,28 +471,28 @@ describe('treesitter highlighting (C)', function() vim.treesitter.highlighter.new(parser, { queries = { c = '(identifier) @type' } }) end) - screen:expect { + screen:expect({ grid = [[ - int {1:width} = {1:INT_MAX}, {1:height} = {1:INT_MAX}; | - bool {1:ext_widgets}[{1:kUIExtCount}]; | - for (UIExtension {1:i} = 0; (int)i < kUIExtCount; i++) { | - ext_widgets[i] = true; | - } | - | - bool {1:inclusive} = {1:ui_override}(); | - for (size_t {1:i} = 0; i < ui_count; i++) { | - UI *{1:ui} = {1:uis}[{1:i}]; | - width = MIN(ui->width, width); | - height = MIN(ui->height, height); | - foo = BAR(ui->bazaar, bazaar); | - for (UIExtension {1:j} = 0; (int)j < kUIExtCount; j++) { | - ext_widgets[j] &= (ui->ui_ext[j] || inclusive); | - } | - } | - ^} | - | - ]], - } + int {6:width} = {6:INT_MAX}, {6:height} = {6:INT_MAX}; | + bool {6:ext_widgets}[{6:kUIExtCount}]; | + for (UIExtension {6:i} = 0; (int)i < kUIExtCount; i++) { | + ext_widgets[i] = true; | + } | + | + bool {6:inclusive} = {6:ui_override}(); | + for (size_t {6:i} = 0; i < ui_count; i++) { | + UI *{6:ui} = {6:uis}[{6:i}]; | + width = MIN(ui->width, width); | + height = MIN(ui->height, height); | + foo = BAR(ui->bazaar, bazaar); | + for (UIExtension {6:j} = 0; (int)j < kUIExtCount; j++) { | + ext_widgets[j] &= (ui->ui_ext[j] || inclusive); | + } | + } | + ^} | + | + ]], + }) end) it('supports injected languages', function() @@ -567,18 +550,18 @@ describe('treesitter highlighting (C)', function() vim.treesitter.highlighter.new(vim.treesitter.get_parser(0, 'c')) end) - screen:expect { + screen:expect({ grid = [[ - {3:int} x = {5:INT_MAX}; | - #define {5:READ_STRING}(x, y) ({3:char} *)read_string((x), ({3:size_t})(y)) | - #define foo {3:void} main() { \ | - {4:return} {5:42}; \ | - } | - ^ | - {1:~ }|*11 - | - ]], - } + {6:int} x = {26:INT_MAX}; | + #define {26:READ_STRING}(x, y) ({6:char} *)read_string((x), ({6:size_t})(y)) | + #define foo {6:void} main() { \ | + {15:return} {26:42}; \ | + } | + ^ | + {1:~ }|*11 + | + ]], + }) end) it('supports highlighting with custom highlight groups', function() @@ -595,27 +578,27 @@ describe('treesitter highlighting (C)', function() -- This will change ONLY the literal strings to look like comments -- The only literal string is the "vim.schedule: expected function" in this test. exec_lua [[vim.cmd("highlight link @string.nonexistent_specializer comment")]] - screen:expect { + screen:expect({ grid = [[ - {2:^/// Schedule Lua callback on main loop's event queue} | - {3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) | - { | - {4:if} ({11:lua_type}(lstate, {5:1}) != {5:LUA_TFUNCTION} | - || {6:lstate} != {6:lstate}) { | - {11:lua_pushliteral}(lstate, {2:"vim.schedule: expected function"}); | - {4:return} {11:lua_error}(lstate); | - } | - | - {7:LuaRef} cb = {11:nlua_ref}(lstate, {5:1}); | - | - multiqueue_put(main_loop.events, {11:nlua_schedule_event}, | - {5:1}, ({3:void} *)({3:ptrdiff_t})cb); | - {4:return} {5:0}; | - } | - {1:~ }|*2 - | - ]], - } + {18:^/// Schedule Lua callback on main loop's event queue} | + {6:static} {6:int} {25:nlua_schedule}({6:lua_State} *{6:const} lstate) | + { | + {15:if} ({25:lua_type}(lstate, {26:1}) != {26:LUA_TFUNCTION} | + || {19:lstate} != {19:lstate}) { | + {25:lua_pushliteral}(lstate, {18:"vim.schedule: expected function"}); | + {15:return} {25:lua_error}(lstate); | + } | + | + {29:LuaRef} cb = {25:nlua_ref}(lstate, {26:1}); | + | + multiqueue_put(main_loop.events, {25:nlua_schedule_event}, | + {26:1}, ({6:void} *)({6:ptrdiff_t})cb); | + {15:return} {26:0}; | + } | + {1:~ }|*2 + | + ]], + }) screen:expect { unchanged = true } end) @@ -657,8 +640,8 @@ describe('treesitter highlighting (C)', function() } eq({ - { capture = 'constant', metadata = { priority = '101' }, lang = 'c' }, - { capture = 'type', metadata = {}, lang = 'c' }, + { capture = 'constant', metadata = { priority = '101' }, lang = 'c', id = 14 }, + { capture = 'type', metadata = {}, lang = 'c', id = 3 }, }, exec_lua [[ return vim.treesitter.get_captures_at_pos(0, 0, 2) ]]) end) @@ -691,25 +674,25 @@ describe('treesitter highlighting (C)', function() ) end) - screen:expect { + screen:expect({ grid = [[ - {3:char}* x = {5:"Will somebody ever read this?"}; | - ^ | - {1:~ }|*15 - | - ]], - } + {6:char}* x = {26:"Will somebody ever read this?"}; | + ^ | + {1:~ }|*15 + | + ]], + }) -- clearing specialization reactivates fallback command [[ hi clear @foo.bar ]] - screen:expect { + screen:expect({ grid = [[ - {5:char}* x = {5:"Will somebody ever read this?"}; | - ^ | - {1:~ }|*15 - | - ]], - } + {26:char}* x = {26:"Will somebody ever read this?"}; | + ^ | + {1:~ }|*15 + | + ]], + }) end ) @@ -740,27 +723,27 @@ describe('treesitter highlighting (C)', function() }) end) - screen:expect { + screen:expect({ grid = [[ - /// Schedule Lua callback on main loop's event queue | - {4:R} int nlua_schedule(lua_State *const ) | - { | - if (lua_type(, 1) != LUA_TFUNCTION | - || != ) { | - lua_pushliteral(, "vim.schedule: expected function"); | - return lua_error(); | - } | - | - LuaRef cb = nlua_ref(, 1); | - | - {11:V}(main_loop.events, nlua_schedule_event, | - 1, (void *)(ptrdiff_t)cb); | |