mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
test(treesitter): global highlight definitions and fold test #31407
Add test for foldtext= highlighting. Change file to global highlight definitions while at it.
This commit is contained in:
@@ -65,40 +65,40 @@ static int nlua_schedule(lua_State *const lstate)
|
|||||||
}]]
|
}]]
|
||||||
|
|
||||||
local hl_grid_legacy_c = [[
|
local hl_grid_legacy_c = [[
|
||||||
{2:^/// Schedule Lua callback on main loop's event queue} |
|
{18:^/// Schedule Lua callback on main loop's event queue} |
|
||||||
{3:static} {3:int} nlua_schedule(lua_State *{3:const} lstate) |
|
{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) { |
|
|| lstate != lstate) { |
|
||||||
lua_pushliteral(lstate, {5:"vim.schedule: expected function"}); |
|
lua_pushliteral(lstate, {26:"vim.schedule: expected function"}); |
|
||||||
{4:return} lua_error(lstate); |
|
{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, |
|
multiqueue_put(main_loop.events, nlua_schedule_event, |
|
||||||
{5:1}, ({3:void} *)({3:ptrdiff_t})cb); |
|
{26:1}, ({6:void} *)({6:ptrdiff_t})cb); |
|
||||||
{4:return} {5:0}; |
|
{15:return} {26:0}; |
|
||||||
} |
|
} |
|
||||||
{1:~ }|*2
|
{1:~ }|*2
|
||||||
|
|
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local hl_grid_ts_c = [[
|
local hl_grid_ts_c = [[
|
||||||
{2:^/// Schedule Lua callback on main loop's event queue} |
|
{18:^/// Schedule Lua callback on main loop's event queue} |
|
||||||
{3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) |
|
{6:static} {6:int} {25:nlua_schedule}({6:lua_State} *{6:const} lstate) |
|
||||||
{ |
|
{ |
|
||||||
{4:if} ({11:lua_type}(lstate, {5:1}) != {5:LUA_TFUNCTION} |
|
{15:if} ({25:lua_type}(lstate, {26:1}) != {26:LUA_TFUNCTION} |
|
||||||
|| {6:lstate} != {6:lstate}) { |
|
|| {19:lstate} != {19:lstate}) { |
|
||||||
{11:lua_pushliteral}(lstate, {5:"vim.schedule: expected function"}); |
|
{25:lua_pushliteral}(lstate, {26:"vim.schedule: expected function"}); |
|
||||||
{4:return} {11:lua_error}(lstate); |
|
{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}, |
|
multiqueue_put(main_loop.events, {25:nlua_schedule_event}, |
|
||||||
{5:1}, ({3:void} *)({3:ptrdiff_t})cb); |
|
{26:1}, ({6:void} *)({6:ptrdiff_t})cb); |
|
||||||
{4:return} {5:0}; |
|
{15:return} {26:0}; |
|
||||||
} |
|
} |
|
||||||
{1:~ }|*2
|
{1:~ }|*2
|
||||||
|
|
|
|
||||||
@@ -145,10 +145,10 @@ local injection_grid_c = [[
|
|||||||
]]
|
]]
|
||||||
|
|
||||||
local injection_grid_expected_c = [[
|
local injection_grid_expected_c = [[
|
||||||
{3:int} x = {5:INT_MAX}; |
|
{6:int} x = {26:INT_MAX}; |
|
||||||
#define {5:READ_STRING}(x, y) ({3:char} *)read_string((x), ({3:size_t})(y)) |
|
#define {26:READ_STRING}(x, y) ({6:char} *)read_string((x), ({6:size_t})(y)) |
|
||||||
#define foo {3:void} main() { \ |
|
#define foo {6:void} main() { \ |
|
||||||
{4:return} {5:42}; \ |
|
{15:return} {26:42}; \ |
|
||||||
} |
|
} |
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|*11
|
{1:~ }|*11
|
||||||
@@ -161,20 +161,6 @@ describe('treesitter highlighting (C)', function()
|
|||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
screen = Screen.new(65, 18)
|
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 @error ErrorMsg ]]
|
||||||
command [[ hi link @warning WarningMsg ]]
|
command [[ hi link @warning WarningMsg ]]
|
||||||
end)
|
end)
|
||||||
@@ -246,124 +232,124 @@ describe('treesitter highlighting (C)', function()
|
|||||||
|
|
||||||
feed('5Goc<esc>dd')
|
feed('5Goc<esc>dd')
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{2:/// Schedule Lua callback on main loop's event queue} |
|
{18:/// Schedule Lua callback on main loop's event queue} |
|
||||||
{3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) |
|
{6:static} {6:int} {25:nlua_schedule}({6:lua_State} *{6:const} lstate) |
|
||||||
{ |
|
{ |
|
||||||
{4:if} ({11:lua_type}(lstate, {5:1}) != {5:LUA_TFUNCTION} |
|
{15:if} ({25:lua_type}(lstate, {26:1}) != {26:LUA_TFUNCTION} |
|
||||||
|| {6:lstate} != {6:lstate}) { |
|
|| {19:lstate} != {19:lstate}) { |
|
||||||
{11:^lua_pushliteral}(lstate, {5:"vim.schedule: expected function"}); |
|
{25:^lua_pushliteral}(lstate, {26:"vim.schedule: expected function"}); |
|
||||||
{4:return} {11:lua_error}(lstate); |
|
{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}, |
|
multiqueue_put(main_loop.events, {25:nlua_schedule_event}, |
|
||||||
{5:1}, ({3:void} *)({3:ptrdiff_t})cb); |
|
{26:1}, ({6:void} *)({6:ptrdiff_t})cb); |
|
||||||
{4:return} {5:0}; |
|
{15:return} {26:0}; |
|
||||||
} |
|
} |
|
||||||
{1:~ }|*2
|
{1:~ }|*2
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
|
|
||||||
feed('7Go*/<esc>')
|
feed('7Go*/<esc>')
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{2:/// Schedule Lua callback on main loop's event queue} |
|
{18:/// Schedule Lua callback on main loop's event queue} |
|
||||||
{3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) |
|
{6:static} {6:int} {25:nlua_schedule}({6:lua_State} *{6:const} lstate) |
|
||||||
{ |
|
{ |
|
||||||
{4:if} ({11:lua_type}(lstate, {5:1}) != {5:LUA_TFUNCTION} |
|
{15:if} ({25:lua_type}(lstate, {26:1}) != {26:LUA_TFUNCTION} |
|
||||||
|| {6:lstate} != {6:lstate}) { |
|
|| {19:lstate} != {19:lstate}) { |
|
||||||
{11:lua_pushliteral}(lstate, {5:"vim.schedule: expected function"}); |
|
{25:lua_pushliteral}(lstate, {26:"vim.schedule: expected function"}); |
|
||||||
{4:return} {11:lua_error}(lstate); |
|
{15:return} {25:lua_error}(lstate); |
|
||||||
{8:*^/} |
|
{9:*^/} |
|
||||||
} |
|
} |
|
||||||
|
|
|
|
||||||
{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}, |
|
multiqueue_put(main_loop.events, {25:nlua_schedule_event}, |
|
||||||
{5:1}, ({3:void} *)({3:ptrdiff_t})cb); |
|
{26:1}, ({6:void} *)({6:ptrdiff_t})cb); |
|
||||||
{4:return} {5:0}; |
|
{15:return} {26:0}; |
|
||||||
} |
|
} |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
|
|
||||||
feed('3Go/*<esc>')
|
feed('3Go/*<esc>')
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{2:/// Schedule Lua callback on main loop's event queue} |
|
{18:/// Schedule Lua callback on main loop's event queue} |
|
||||||
{3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) |
|
{6:static} {6:int} {25:nlua_schedule}({6:lua_State} *{6:const} lstate) |
|
||||||
{ |
|
{ |
|
||||||
{2:/^*} |
|
{18:/^*} |
|
||||||
{2: if (lua_type(lstate, 1) != LUA_TFUNCTION} |
|
{18: if (lua_type(lstate, 1) != LUA_TFUNCTION} |
|
||||||
{2: || lstate != lstate) {} |
|
{18: || lstate != lstate) {} |
|
||||||
{2: lua_pushliteral(lstate, "vim.schedule: expected function");} |
|
{18: lua_pushliteral(lstate, "vim.schedule: expected function");} |
|
||||||
{2: return lua_error(lstate);} |
|
{18: return lua_error(lstate);} |
|
||||||
{2:*/} |
|
{18:*/} |
|
||||||
} |
|
} |
|
||||||
|
|
|
|
||||||
{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}, |
|
multiqueue_put(main_loop.events, {25:nlua_schedule_event}, |
|
||||||
{5:1}, ({3:void} *)({3:ptrdiff_t})cb); |
|
{26:1}, ({6:void} *)({6:ptrdiff_t})cb); |
|
||||||
{4:return} {5:0}; |
|
{15:return} {26:0}; |
|
||||||
{8:}} |
|
{9:}} |
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
|
|
||||||
feed('gg$')
|
feed('gg$')
|
||||||
feed('~')
|
feed('~')
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{2:/// Schedule Lua callback on main loop's event queu^E} |
|
{18:/// Schedule Lua callback on main loop's event queu^E} |
|
||||||
{3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) |
|
{6:static} {6:int} {25:nlua_schedule}({6:lua_State} *{6:const} lstate) |
|
||||||
{ |
|
{ |
|
||||||
{2:/*} |
|
{18:/*} |
|
||||||
{2: if (lua_type(lstate, 1) != LUA_TFUNCTION} |
|
{18: if (lua_type(lstate, 1) != LUA_TFUNCTION} |
|
||||||
{2: || lstate != lstate) {} |
|
{18: || lstate != lstate) {} |
|
||||||
{2: lua_pushliteral(lstate, "vim.schedule: expected function");} |
|
{18: lua_pushliteral(lstate, "vim.schedule: expected function");} |
|
||||||
{2: return lua_error(lstate);} |
|
{18: return lua_error(lstate);} |
|
||||||
{2:*/} |
|
{18:*/} |
|
||||||
} |
|
} |
|
||||||
|
|
|
|
||||||
{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}, |
|
multiqueue_put(main_loop.events, {25:nlua_schedule_event}, |
|
||||||
{5:1}, ({3:void} *)({3:ptrdiff_t})cb); |
|
{26:1}, ({6:void} *)({6:ptrdiff_t})cb); |
|
||||||
{4:return} {5:0}; |
|
{15:return} {26:0}; |
|
||||||
{8:}} |
|
{9:}} |
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
|
|
||||||
feed('re')
|
feed('re')
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{2:/// Schedule Lua callback on main loop's event queu^e} |
|
{18:/// Schedule Lua callback on main loop's event queu^e} |
|
||||||
{3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) |
|
{6:static} {6:int} {25:nlua_schedule}({6:lua_State} *{6:const} lstate) |
|
||||||
{ |
|
{ |
|
||||||
{2:/*} |
|
{18:/*} |
|
||||||
{2: if (lua_type(lstate, 1) != LUA_TFUNCTION} |
|
{18: if (lua_type(lstate, 1) != LUA_TFUNCTION} |
|
||||||
{2: || lstate != lstate) {} |
|
{18: || lstate != lstate) {} |
|
||||||
{2: lua_pushliteral(lstate, "vim.schedule: expected function");} |
|
{18: lua_pushliteral(lstate, "vim.schedule: expected function");} |
|
||||||
{2: return lua_error(lstate);} |
|
{18: return lua_error(lstate);} |
|
||||||
{2:*/} |
|
{18:*/} |
|
||||||
} |
|
} |
|
||||||
|
|
|
|
||||||
{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}, |
|
multiqueue_put(main_loop.events, {25:nlua_schedule_event}, |
|
||||||
{5:1}, ({3:void} *)({3:ptrdiff_t})cb); |
|
{26:1}, ({6:void} *)({6:ptrdiff_t})cb); |
|
||||||
{4:return} {5:0}; |
|
{15:return} {26:0}; |
|
||||||
{8:}} |
|
{9:}} |
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('is updated with :sort', function()
|
it('is updated with :sort', function()
|
||||||
@@ -372,83 +358,79 @@ describe('treesitter highlighting (C)', function()
|
|||||||
local parser = vim.treesitter.get_parser(0, 'c')
|
local parser = vim.treesitter.get_parser(0, 'c')
|
||||||
vim.treesitter.highlighter.new(parser, { queries = { c = hl_query_c } })
|
vim.treesitter.highlighter.new(parser, { queries = { c = hl_query_c } })
|
||||||
end)
|
end)
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{3:int} width = {5:INT_MAX}, height = {5:INT_MAX}; |
|
{6:int} width = {26:INT_MAX}, height = {26:INT_MAX}; |
|
||||||
{3:bool} ext_widgets[kUIExtCount]; |
|
{6:bool} ext_widgets[kUIExtCount]; |
|
||||||
{4:for} ({3:UIExtension} i = {5:0}; ({3:int})i < kUIExtCount; i++) { |
|
{15:for} ({6:UIExtension} i = {26:0}; ({6:int})i < kUIExtCount; i++) { |
|
||||||
ext_widgets[i] = true; |
|
ext_widgets[i] = true; |
|
||||||
} |
|
} |
|
||||||
|
|
|
|
||||||
{3:bool} inclusive = ui_override(); |
|
{6:bool} inclusive = ui_override(); |
|
||||||
{4:for} ({3:size_t} i = {5:0}; i < ui_count; i++) { |
|
{15:for} ({6:size_t} i = {26:0}; i < ui_count; i++) { |
|
||||||
{3:UI} *ui = uis[i]; |
|
{6:UI} *ui = uis[i]; |
|
||||||
width = {5:MIN}(ui->width, width); |
|
width = {26:MIN}(ui->width, width); |
|
||||||
height = {5:MIN}(ui->height, height); |
|
height = {26:MIN}(ui->height, height); |
|
||||||
foo = {5:BAR}(ui->bazaar, bazaar); |
|
foo = {26:BAR}(ui->bazaar, bazaar); |
|
||||||
{4:for} ({3:UIExtension} j = {5:0}; ({3:int})j < kUIExtCount; j++) { |
|
{15:for} ({6:UIExtension} j = {26:0}; ({6:int})j < kUIExtCount; j++) { |
|
||||||
ext_widgets[j] &= (ui->ui_ext[j] || inclusive); |
|
ext_widgets[j] &= (ui->ui_ext[j] || inclusive); |
|
||||||
} |
|
} |
|
||||||
} |
|
} |
|
||||||
^} |
|
^} |
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
|
|
||||||
feed ':sort<cr>'
|
feed ':sort<cr>'
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
^ |
|
^ |
|
||||||
ext_widgets[j] &= (ui->ui_ext[j] || inclusive); |
|
ext_widgets[j] &= (ui->ui_ext[j] || inclusive); |
|
||||||
{3:UI} *ui = uis[i]; |
|
{6:UI} *ui = uis[i]; |
|
||||||
ext_widgets[i] = true; |
|
ext_widgets[i] = true; |
|
||||||
foo = {5:BAR}(ui->bazaar, bazaar); |
|
foo = {26:BAR}(ui->bazaar, bazaar); |
|
||||||
{4:for} ({3:UIExtension} j = {5:0}; ({3:int})j < kUIExtCount; j++) { |
|
{15:for} ({6:UIExtension} j = {26:0}; ({6:int})j < kUIExtCount; j++) { |
|
||||||
height = {5:MIN}(ui->height, height); |
|
height = {26:MIN}(ui->height, height); |
|
||||||
width = {5:MIN}(ui->width, width); |
|
width = {26:MIN}(ui->width, width); |
|
||||||
} |
|
} |
|
||||||
{3:bool} ext_widgets[kUIExtCount]; |
|
{6:bool} ext_widgets[kUIExtCount]; |
|
||||||
{3:bool} inclusive = ui_override(); |
|
{6:bool} inclusive = ui_override(); |
|
||||||
{4:for} ({3:UIExtension} i = {5:0}; ({3:int})i < kUIExtCount; i++) { |
|
{15:for} ({6:UIExtension} i = {26:0}; ({6:int})i < kUIExtCount; i++) { |
|
||||||
{4:for} ({3:size_t} i = {5:0}; i < ui_count; i++) { |
|
{15:for} ({6:size_t} i = {26:0}; i < ui_count; i++) { |
|
||||||
{3:int} width = {5:INT_MAX}, height = {5:INT_MAX}; |
|
{6:int} width = {26:INT_MAX}, height = {26:INT_MAX}; |
|
||||||
} |*2
|
} |*2
|
||||||
{3:void} ui_refresh({3:void}) |
|
{6:void} ui_refresh({6:void}) |
|
||||||
:sort |
|
:sort |
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
|
|
||||||
feed 'u'
|
feed 'u'
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{3:int} width = {5:INT_MAX}, height = {5:INT_MAX}; |
|
{6:int} width = {26:INT_MAX}, height = {26:INT_MAX}; |
|
||||||
{3:bool} ext_widgets[kUIExtCount]; |
|
{6:bool} ext_widgets[kUIExtCount]; |
|
||||||
{4:for} ({3:UIExtension} i = {5:0}; ({3:int})i < kUIExtCount; i++) { |
|
{15:for} ({6:UIExtension} i = {26:0}; ({6:int})i < kUIExtCount; i++) { |
|
||||||
ext_widgets[i] = true; |
|
ext_widgets[i] = true; |
|
||||||
} |
|
} |
|
||||||
|
|
|
|
||||||
{3:bool} inclusive = ui_override(); |
|
{6:bool} inclusive = ui_override(); |
|
||||||
{4:for} ({3:size_t} i = {5:0}; i < ui_count; i++) { |
|
{15:for} ({6:size_t} i = {26:0}; i < ui_count; i++) { |
|
||||||
{3:UI} *ui = uis[i]; |
|
{6:UI} *ui = uis[i]; |
|
||||||
width = {5:MIN}(ui->width, width); |
|
width = {26:MIN}(ui->width, width); |
|
||||||
height = {5:MIN}(ui->height, height); |
|
height = {26:MIN}(ui->height, height); |
|
||||||
foo = {5:BAR}(ui->bazaar, bazaar); |
|
foo = {26:BAR}(ui->bazaar, bazaar); |
|
||||||
{4:for} ({3:UIExtension} j = {5:0}; ({3:int})j < kUIExtCount; j++) { |
|
{15:for} ({6:UIExtension} j = {26:0}; ({6:int})j < kUIExtCount; j++) { |
|
||||||
ext_widgets[j] &= (ui->ui_ext[j] || inclusive); |
|
ext_widgets[j] &= (ui->ui_ext[j] || inclusive); |
|
||||||
} |
|
} |
|
||||||
} |
|
} |
|
||||||
^} |
|
^} |
|
||||||
19 changes; before #2 {MATCH:.*}|
|
19 changes; before #2 0 seconds ago |
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('supports with custom parser', function()
|
it('supports with custom parser', function()
|
||||||
screen:set_default_attr_ids {
|
|
||||||
[1] = { bold = true, foreground = Screen.colors.SeaGreen4 },
|
|
||||||
}
|
|
||||||
|
|
||||||
insert(test_text_c)
|
insert(test_text_c)
|
||||||
|
|
||||||
screen:expect {
|
screen:expect {
|
||||||
@@ -488,28 +470,28 @@ describe('treesitter highlighting (C)', function()
|
|||||||
vim.treesitter.highlighter.new(parser, { queries = { c = '(identifier) @type' } })
|
vim.treesitter.highlighter.new(parser, { queries = { c = '(identifier) @type' } })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
int {1:width} = {1:INT_MAX}, {1:height} = {1:INT_MAX}; |
|
int {6:width} = {6:INT_MAX}, {6:height} = {6:INT_MAX}; |
|
||||||
bool {1:ext_widgets}[{1:kUIExtCount}]; |
|
bool {6:ext_widgets}[{6:kUIExtCount}]; |
|
||||||
for (UIExtension {1:i} = 0; (int)i < kUIExtCount; i++) { |
|
for (UIExtension {6:i} = 0; (int)i < kUIExtCount; i++) { |
|
||||||
ext_widgets[i] = true; |
|
ext_widgets[i] = true; |
|
||||||
} |
|
} |
|
||||||
|
|
|
|
||||||
bool {1:inclusive} = {1:ui_override}(); |
|
bool {6:inclusive} = {6:ui_override}(); |
|
||||||
for (size_t {1:i} = 0; i < ui_count; i++) { |
|
for (size_t {6:i} = 0; i < ui_count; i++) { |
|
||||||
UI *{1:ui} = {1:uis}[{1:i}]; |
|
UI *{6:ui} = {6:uis}[{6:i}]; |
|
||||||
width = MIN(ui->width, width); |
|
width = MIN(ui->width, width); |
|
||||||
height = MIN(ui->height, height); |
|
height = MIN(ui->height, height); |
|
||||||
foo = BAR(ui->bazaar, bazaar); |
|
foo = BAR(ui->bazaar, bazaar); |
|
||||||
for (UIExtension {1:j} = 0; (int)j < kUIExtCount; j++) { |
|
for (UIExtension {6:j} = 0; (int)j < kUIExtCount; j++) { |
|
||||||
ext_widgets[j] &= (ui->ui_ext[j] || inclusive); |
|
ext_widgets[j] &= (ui->ui_ext[j] || inclusive); |
|
||||||
} |
|
} |
|
||||||
} |
|
} |
|
||||||
^} |
|
^} |
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('supports injected languages', function()
|
it('supports injected languages', function()
|
||||||
@@ -567,18 +549,18 @@ describe('treesitter highlighting (C)', function()
|
|||||||
vim.treesitter.highlighter.new(vim.treesitter.get_parser(0, 'c'))
|
vim.treesitter.highlighter.new(vim.treesitter.get_parser(0, 'c'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{3:int} x = {5:INT_MAX}; |
|
{6:int} x = {26:INT_MAX}; |
|
||||||
#define {5:READ_STRING}(x, y) ({3:char} *)read_string((x), ({3:size_t})(y)) |
|
#define {26:READ_STRING}(x, y) ({6:char} *)read_string((x), ({6:size_t})(y)) |
|
||||||
#define foo {3:void} main() { \ |
|
#define foo {6:void} main() { \ |
|
||||||
{4:return} {5:42}; \ |
|
{15:return} {26:42}; \ |
|
||||||
} |
|
} |
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|*11
|
{1:~ }|*11
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('supports highlighting with custom highlight groups', function()
|
it('supports highlighting with custom highlight groups', function()
|
||||||
@@ -595,27 +577,27 @@ describe('treesitter highlighting (C)', function()
|
|||||||
-- This will change ONLY the literal strings to look like comments
|
-- This will change ONLY the literal strings to look like comments
|
||||||
-- The only literal string is the "vim.schedule: expected function" in this test.
|
-- The only literal string is the "vim.schedule: expected function" in this test.
|
||||||
exec_lua [[vim.cmd("highlight link @string.nonexistent_specializer comment")]]
|
exec_lua [[vim.cmd("highlight link @string.nonexistent_specializer comment")]]
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{2:^/// Schedule Lua callback on main loop's event queue} |
|
{18:^/// Schedule Lua callback on main loop's event queue} |
|
||||||
{3:static} {3:int} {11:nlua_schedule}({3:lua_State} *{3:const} lstate) |
|
{6:static} {6:int} {25:nlua_schedule}({6:lua_State} *{6:const} lstate) |
|
||||||
{ |
|
{ |
|
||||||
{4:if} ({11:lua_type}(lstate, {5:1}) != {5:LUA_TFUNCTION} |
|
{15:if} ({25:lua_type}(lstate, {26:1}) != {26:LUA_TFUNCTION} |
|
||||||
|| {6:lstate} != {6:lstate}) { |
|
|| {19:lstate} != {19:lstate}) { |
|
||||||
{11:lua_pushliteral}(lstate, {2:"vim.schedule: expected function"}); |
|
{25:lua_pushliteral}(lstate, {18:"vim.schedule: expected function"}); |
|
||||||
{4:return} {11:lua_error}(lstate); |
|
{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}, |
|
multiqueue_put(main_loop.events, {25:nlua_schedule_event}, |
|
||||||
{5:1}, ({3:void} *)({3:ptrdiff_t})cb); |
|
{26:1}, ({6:void} *)({6:ptrdiff_t})cb); |
|
||||||
{4:return} {5:0}; |
|
{15:return} {26:0}; |
|
||||||
} |
|
} |
|
||||||
{1:~ }|*2
|
{1:~ }|*2
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
screen:expect { unchanged = true }
|
screen:expect { unchanged = true }
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -691,25 +673,25 @@ describe('treesitter highlighting (C)', function()
|
|||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{3:char}* x = {5:"Will somebody ever read this?"}; |
|
{6:char}* x = {26:"Will somebody ever read this?"}; |
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|*15
|
{1:~ }|*15
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
|
|
||||||
-- clearing specialization reactivates fallback
|
-- clearing specialization reactivates fallback
|
||||||
command [[ hi clear @foo.bar ]]
|
command [[ hi clear @foo.bar ]]
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{5:char}* x = {5:"Will somebody ever read this?"}; |
|
{26:char}* x = {26:"Will somebody ever read this?"}; |
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|*15
|
{1:~ }|*15
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -740,10 +722,10 @@ describe('treesitter highlighting (C)', function()
|
|||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
/// Schedule Lua callback on main loop's event queue |
|
/// Schedule Lua callback on main loop's event queue |
|
||||||
{4:R} int nlua_schedule(lua_State *const ) |
|
{15:R} int nlua_schedule(lua_State *const ) |
|
||||||
{ |
|
{ |
|
||||||
if (lua_type(, 1) != LUA_TFUNCTION |
|
if (lua_type(, 1) != LUA_TFUNCTION |
|
||||||
|| != ) { |
|
|| != ) { |
|
||||||
@@ -753,14 +735,14 @@ describe('treesitter highlighting (C)', function()
|
|||||||
|
|
|
|
||||||
LuaRef cb = nlua_ref(, 1); |
|
LuaRef cb = nlua_ref(, 1); |
|
||||||
|
|
|
|
||||||
{11:V}(main_loop.events, nlua_schedule_event, |
|
{25:V}(main_loop.events, nlua_schedule_event, |
|
||||||
1, (void *)(ptrdiff_t)cb); |
|
1, (void *)(ptrdiff_t)cb); |
|
||||||
return 0; |
|
return 0; |
|
||||||
^} |
|
^} |
|
||||||
{1:~ }|*2
|
{1:~ }|*2
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('@foo.bar groups has the correct fallback behavior', function()
|
it('@foo.bar groups has the correct fallback behavior', function()
|
||||||
@@ -801,16 +783,16 @@ describe('treesitter highlighting (C)', function()
|
|||||||
vim.treesitter.highlighter.new(vim.treesitter.get_parser(0, 'c'))
|
vim.treesitter.highlighter.new(vim.treesitter.get_parser(0, 'c'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{5:int x = 4;} |
|
{26:int x = 4;} |
|
||||||
{5:int y = 5;} |
|
{26:int y = 5;} |
|
||||||
{5:int z = 6;} |
|
{26:int z = 6;} |
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|*13
|
{1:~ }|*13
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('gives higher priority to more specific captures #27895', function()
|
it('gives higher priority to more specific captures #27895', function()
|
||||||
@@ -830,14 +812,52 @@ describe('treesitter highlighting (C)', function()
|
|||||||
vim.treesitter.highlighter.new(vim.treesitter.get_parser(0, 'c'))
|
vim.treesitter.highlighter.new(vim.treesitter.get_parser(0, 'c'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
void foo(int {4:*}{11:bar}); |
|
void foo(int {15:*}{25:bar}); |
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|*15
|
{1:~ }|*15
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('highlights applied to first line of closed fold', function()
|
||||||
|
insert(hl_text_c)
|
||||||
|
exec_lua(function()
|
||||||
|
vim.treesitter.query.set('c', 'highlights', hl_query_c)
|
||||||
|
vim.treesitter.highlighter.new(vim.treesitter.get_parser(0, 'c'))
|
||||||
|
end)
|
||||||
|
feed('ggjzfj')
|
||||||
|
command('set foldtext=')
|
||||||
|
screen:add_extra_attr_ids({
|
||||||
|
[100] = {
|
||||||
|
bold = true,
|
||||||
|
background = Screen.colors.LightGray,
|
||||||
|
foreground = Screen.colors.SeaGreen4,
|
||||||
|
},
|
||||||
|
[101] = { background = Screen.colors.LightGray, foreground = Screen.colors.DarkCyan },
|
||||||
|
})
|
||||||
|
screen:expect({
|
||||||
|
grid = [[
|
||||||
|
{18:/// Schedule Lua callback on main loop's event queue} |
|
||||||
|
{100:^static}{13: }{100:int}{13: }{101:nlua_schedule}{13:(}{100:lua_State}{13: *}{100:const}{13: 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:~ }|*3
|
||||||
|
|
|
||||||
|
]],
|
||||||
|
})
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -847,13 +867,6 @@ describe('treesitter highlighting (lua)', function()
|
|||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
screen = Screen.new(65, 18)
|
screen = Screen.new(65, 18)
|
||||||
screen:set_default_attr_ids {
|
|
||||||
[1] = { bold = true, foreground = Screen.colors.Blue },
|
|
||||||
[2] = { foreground = Screen.colors.DarkCyan },
|
|
||||||
[3] = { foreground = Screen.colors.Magenta },
|
|
||||||
[4] = { foreground = Screen.colors.SlateBlue },
|
|
||||||
[5] = { bold = true, foreground = Screen.colors.Brown },
|
|
||||||
}
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('supports language injections', function()
|
it('supports language injections', function()
|
||||||
@@ -867,15 +880,15 @@ describe('treesitter highlighting (lua)', function()
|
|||||||
vim.treesitter.start()
|
vim.treesitter.start()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{5:local} {2:ffi} {5:=} {4:require(}{3:'ffi'}{4:)} |
|
{15:local} {25:ffi} {15:=} {16:require(}{26:'ffi'}{16:)} |
|
||||||
{2:ffi}{4:.}{2:cdef}{4:(}{3:"}{4:int}{3: }{4:(}{5:*}{3:fun}{4:)(int,}{3: }{4:char}{3: }{5:*}{4:);}{3:"}{4:)} |
|
{25:ffi}{16:.}{25:cdef}{16:(}{26:"}{16:int}{26: }{16:(}{15:*}{26:fun}{16:)(int,}{26: }{16:char}{26: }{15:*}{16:);}{26:"}{16:)} |
|
||||||
^ |
|
^ |
|
||||||
{1:~ }|*14
|
{1:~ }|*14
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -885,16 +898,6 @@ describe('treesitter highlighting (help)', function()
|
|||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
screen = Screen.new(40, 6)
|
screen = Screen.new(40, 6)
|
||||||
screen:set_default_attr_ids {
|
|
||||||
[1] = { foreground = Screen.colors.Blue1 },
|
|
||||||
[2] = { bold = true, foreground = Screen.colors.Blue1 },
|
|
||||||
[3] = { bold = true, foreground = Screen.colors.Brown },
|
|
||||||
[4] = { foreground = Screen.colors.Cyan4 },
|
|
||||||
[5] = { foreground = Screen.colors.Magenta1 },
|
|
||||||
title = { bold = true, foreground = Screen.colors.Magenta1 },
|
|
||||||
h1_delim = { nocombine = true, underdouble = true },
|
|
||||||
h2_delim = { nocombine = true, underline = true },
|
|
||||||
}
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('defaults in vimdoc/highlights.scm', function()
|
it('defaults in vimdoc/highlights.scm', function()
|
||||||
@@ -918,13 +921,18 @@ describe('treesitter highlighting (help)', function()
|
|||||||
vim.treesitter.start()
|
vim.treesitter.start()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
screen:add_extra_attr_ids({
|
||||||
|
[100] = { nocombine = true, underdouble = true },
|
||||||
|
[101] = { foreground = Screen.colors.Fuchsia, bold = true },
|
||||||
|
[102] = { underline = true, nocombine = true },
|
||||||
|
})
|
||||||
screen:expect({
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{h1_delim:^========================================}|
|
{100:^========================================}|
|
||||||
{title:NVIM DOCUMENTATION} |
|
{101:NVIM DOCUMENTATION} |
|
||||||
|
|
|
|
||||||
{h2_delim:----------------------------------------}|
|
{102:----------------------------------------}|
|
||||||
{title:ABOUT NVIM} |
|
{101:ABOUT NVIM} |
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
})
|
})
|
||||||
@@ -943,42 +951,42 @@ describe('treesitter highlighting (help)', function()
|
|||||||
vim.treesitter.start()
|
vim.treesitter.start()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{1:>}{3:ruby} |
|
{18:>}{15:ruby} |
|
||||||
{1: -- comment} |
|
{18: -- comment} |
|
||||||
{1: local this_is = 'actually_lua'} |
|
{18: local this_is = 'actually_lua'} |
|
||||||
{1:<} |
|
{18:<} |
|
||||||
^ |
|
^ |
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
|
|
||||||
n.api.nvim_buf_set_text(0, 0, 1, 0, 5, { 'lua' })
|
n.api.nvim_buf_set_text(0, 0, 1, 0, 5, { 'lua' })
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{1:>}{3:lua} |
|
{18:>}{15:lua} |
|
||||||
{1: -- comment} |
|
{18: -- comment} |
|
||||||
{1: }{3:local}{1: }{4:this_is}{1: }{3:=}{1: }{5:'actually_lua'} |
|
{18: }{15:local}{18: }{25:this_is}{18: }{15:=}{18: }{26:'actually_lua'} |
|
||||||
{1:<} |
|
{18:<} |
|
||||||
^ |
|
^ |
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
|
|
||||||
n.api.nvim_buf_set_text(0, 0, 1, 0, 4, { 'ruby' })
|
n.api.nvim_buf_set_text(0, 0, 1, 0, 4, { 'ruby' })
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{1:>}{3:ruby} |
|
{18:>}{15:ruby} |
|
||||||
{1: -- comment} |
|
{18: -- comment} |
|
||||||
{1: local this_is = 'actually_lua'} |
|
{18: local this_is = 'actually_lua'} |
|
||||||
{1:<} |
|
{18:<} |
|
||||||
^ |
|
^ |
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('correctly redraws injections subpriorities', function()
|
it('correctly redraws injections subpriorities', function()
|
||||||
@@ -1003,16 +1011,16 @@ describe('treesitter highlighting (help)', function()
|
|||||||
vim.treesitter.highlighter.new(parser)
|
vim.treesitter.highlighter.new(parser)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [=[
|
grid = [=[
|
||||||
{3:local} {4:s} {3:=} {5:[[} |
|
{15:local} {25:s} {15:=} {26:[[} |
|
||||||
{5: }{3:local}{5: }{4:also}{5: }{3:=}{5: }{4:lua} |
|
{26: }{15:local}{26: }{25:also}{26: }{15:=}{26: }{25:lua} |
|
||||||
{5:]]} |
|
{26:]]} |
|
||||||
^ |
|
^ |
|
||||||
{2:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]=],
|
]=],
|
||||||
}
|
})
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -1022,12 +1030,6 @@ describe('treesitter highlighting (nested injections)', function()
|
|||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
screen = Screen.new(80, 7)
|
screen = Screen.new(80, 7)
|
||||||
screen:set_default_attr_ids {
|
|
||||||
[1] = { foreground = Screen.colors.SlateBlue },
|
|
||||||
[2] = { bold = true, foreground = Screen.colors.Brown },
|
|
||||||
[3] = { foreground = Screen.colors.Cyan4 },
|
|
||||||
[4] = { foreground = Screen.colors.Fuchsia },
|
|
||||||
}
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('correctly redraws nested injections (GitHub #25252)', function()
|
it('correctly redraws nested injections (GitHub #25252)', function()
|
||||||
@@ -1054,32 +1056,32 @@ vim.cmd([[
|
|||||||
-- invalidate the language tree
|
-- invalidate the language tree
|
||||||
feed('ggi--[[<ESC>04x')
|
feed('ggi--[[<ESC>04x')
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{2:^function} {3:foo}{1:()} {1:print(}{4:"Lua!"}{1:)} {2:end} |
|
{15:^function} {25:foo}{16:()} {16:print(}{26:"Lua!"}{16:)} {15:end} |
|
||||||
|
|
|
|
||||||
{2:local} {3:lorem} {2:=} {1:{} |
|
{15:local} {25:lorem} {15:=} {16:{} |
|
||||||
{3:ipsum} {2:=} {1:{},} |
|
{25:ipsum} {15:=} {16:{},} |
|
||||||
{3:bar} {2:=} {1:{},} |
|
{25:bar} {15:=} {16:{},} |
|
||||||
{1:}} |
|
{16:}} |
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
|
|
||||||
-- spam newline insert/delete to invalidate Lua > Vim > Lua region
|
-- spam newline insert/delete to invalidate Lua > Vim > Lua region
|
||||||
feed('3jo<ESC>ddko<ESC>ddko<ESC>ddko<ESC>ddk0')
|
feed('3jo<ESC>ddko<ESC>ddko<ESC>ddko<ESC>ddk0')
|
||||||
|
|
||||||
screen:expect {
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{2:function} {3:foo}{1:()} {1:print(}{4:"Lua!"}{1:)} {2:end} |
|
{15:function} {25:foo}{16:()} {16:print(}{26:"Lua!"}{16:)} {15:end} |
|
||||||
|
|
|
|
||||||
{2:local} {3:lorem} {2:=} {1:{} |
|
{15:local} {25:lorem} {15:=} {16:{} |
|
||||||
^ {3:ipsum} {2:=} {1:{},} |
|
^ {25:ipsum} {15:=} {16:{},} |
|
||||||
{3:bar} {2:=} {1:{},} |
|
{25:bar} {15:=} {16:{},} |
|
||||||
{1:}} |
|
{16:}} |
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
}
|
})
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -1156,20 +1158,6 @@ it('starting and stopping treesitter highlight in init.lua works #29541', functi
|
|||||||
eq('', api.nvim_get_vvar('errmsg'))
|
eq('', api.nvim_get_vvar('errmsg'))
|
||||||
|
|
||||||
local screen = Screen.new(65, 18)
|
local 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 },
|
|
||||||
}
|
|
||||||
|
|
||||||
fn.setreg('r', hl_text_c)
|
fn.setreg('r', hl_text_c)
|
||||||
feed('i<C-R><C-O>r<Esc>gg')
|
feed('i<C-R><C-O>r<Esc>gg')
|
||||||
-- legacy syntax highlighting is used
|
-- legacy syntax highlighting is used
|
||||||
|
Reference in New Issue
Block a user