From cbbf8bd666c8419fdab80a0887948c8a36279c19 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 24 Mar 2023 14:43:14 +0000 Subject: feat(treesitter)!: deprecate top level indexes to modules (#22761) The following top level Treesitter functions have been moved: - vim.treesitter.inspect_language() -> vim.treesitter.language.inspect() - vim.treesitter.get_query_files() -> vim.treesitter.query.get_files() - vim.treesitter.set_query() -> vim.treesitter.query.set() - vim.treesitter.query.set_query() -> vim.treesitter.query.set() - vim.treesitter.get_query() -> vim.treesitter.query.get() - vim.treesitter.query.get_query() -> vim.treesitter.query.get() - vim.treesitter.parse_query() -> vim.treesitter.query.parse() - vim.treesitter.query.parse_query() -> vim.treesitter.query.parse() - vim.treesitter.add_predicate() -> vim.treesitter.query.add_predicate() - vim.treesitter.add_directive() -> vim.treesitter.query.add_directive() - vim.treesitter.list_predicates() -> vim.treesitter.query.list_predicates() - vim.treesitter.list_directives() -> vim.treesitter.query.list_directives() - vim.treesitter.query.get_range() -> vim.treesitter.get_range() - vim.treesitter.query.get_node_text() -> vim.treesitter.get_node_text() --- test/functional/treesitter/highlight_spec.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/functional/treesitter/highlight_spec.lua') diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index 2a2311c0fa..44e6500008 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -376,7 +376,7 @@ describe('treesitter highlighting', function() exec_lua [[ parser = vim.treesitter.get_parser(0, "c") - query = vim.treesitter.parse_query("c", "(declaration) @decl") + query = vim.treesitter.query.parse("c", "(declaration) @decl") local nodes = {} for _, node in query:iter_captures(parser:parse()[1]:root(), 0, 0, 19) do @@ -481,8 +481,8 @@ describe('treesitter highlighting', function() exec_lua [[ local injection_query = "(preproc_def (preproc_arg) @c) (preproc_function_def value: (preproc_arg) @c)" - require('vim.treesitter.query').set_query("c", "highlights", hl_query) - require('vim.treesitter.query').set_query("c", "injections", injection_query) + vim.treesitter.query.set("c", "highlights", hl_query) + vim.treesitter.query.set("c", "injections", injection_query) vim.treesitter.highlighter.new(vim.treesitter.get_parser(0, "c")) ]] -- cgit From 90fdaf55c913d07bc80eec6442b02d8c001659b4 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 1 Apr 2023 12:11:24 +0200 Subject: 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. --- test/functional/treesitter/highlight_spec.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'test/functional/treesitter/highlight_spec.lua') 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) -- cgit From d510bfbc8e447b1a60d5ec7faaa8f440eb4ef56f Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 2 Apr 2023 10:11:42 +0200 Subject: refactor: remove char_u (#22829) Closes https://github.com/neovim/neovim/issues/459 --- test/functional/treesitter/highlight_spec.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test/functional/treesitter/highlight_spec.lua') diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index faeb4befcd..4e1efec404 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -413,7 +413,7 @@ describe('treesitter highlighting', function() it("supports injected languages", function() insert([[ int x = INT_MAX; - #define READ_STRING(x, y) (char_u *)read_string((x), (size_t)(y)) + #define READ_STRING(x, y) (char *)read_string((x), (size_t)(y)) #define foo void main() { \ return 42; \ } @@ -421,7 +421,7 @@ describe('treesitter highlighting', function() screen:expect{grid=[[ int x = INT_MAX; | - #define READ_STRING(x, y) (char_u *)read_string((x), (size_t)(y))| + #define READ_STRING(x, y) (char *)read_string((x), (size_t)(y)) | #define foo void main() { \ | return 42; \ | } | @@ -450,7 +450,7 @@ describe('treesitter highlighting', function() screen:expect{grid=[[ {3:int} x = {5:INT_MAX}; | - #define {5:READ_STRING}(x, y) ({3:char_u} *)read_string((x), ({3:size_t})(y))| + #define {5:READ_STRING}(x, y) ({3:char} *)read_string((x), ({3:size_t})(y)) | #define foo {3:void} main() { \ | {4:return} {5:42}; \ | } | @@ -473,7 +473,7 @@ describe('treesitter highlighting', function() it("supports overriding queries, like ", function() insert([[ int x = INT_MAX; - #define READ_STRING(x, y) (char_u *)read_string((x), (size_t)(y)) + #define READ_STRING(x, y) (char *)read_string((x), (size_t)(y)) #define foo void main() { \ return 42; \ } @@ -489,7 +489,7 @@ describe('treesitter highlighting', function() screen:expect{grid=[[ {3:int} x = {5:INT_MAX}; | - #define {5:READ_STRING}(x, y) ({3:char_u} *)read_string((x), ({3:size_t})(y))| + #define {5:READ_STRING}(x, y) ({3:char} *)read_string((x), ({3:size_t})(y)) | #define foo {3:void} main() { \ | {4:return} {5:42}; \ | } | @@ -567,7 +567,7 @@ describe('treesitter highlighting', function() it("supports highlighting with priority", function() insert([[ int x = INT_MAX; - #define READ_STRING(x, y) (char_u *)read_string((x), (size_t)(y)) + #define READ_STRING(x, y) (char *)read_string((x), (size_t)(y)) #define foo void main() { \ return 42; \ } @@ -580,7 +580,7 @@ describe('treesitter highlighting', function() -- expect everything to have Constant highlight screen:expect{grid=[[ {12:int}{8: x = INT_MAX;} | - {8:#define READ_STRING(x, y) (char_u *)read_string((x), (size_t)(y))}| + {8:#define READ_STRING(x, y) (char *)read_string((x), (size_t)(y))} | {8:#define foo void main() { \} | {8: return 42; \} | {8: }} | -- cgit From 19a793545f15bb7e0bac2fc8f705c600e8f9c9bb Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Sun, 30 Apr 2023 16:11:38 +0100 Subject: fix(treesitter): redraw added/removed injections properly (#23287) When injections are added or removed make sure to: - invoke 'changedtree' callbacks for when new trees are added. - invoke 'changedtree' callbacks for when trees are invalidated - redraw regions when languagetree children are removed --- test/functional/treesitter/highlight_spec.lua | 82 +++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 10 deletions(-) (limited to 'test/functional/treesitter/highlight_spec.lua') diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index 4e1efec404..dc303c564f 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -11,7 +11,7 @@ local eq = helpers.eq before_each(clear) -local hl_query = [[ +local hl_query_c = [[ (ERROR) @error "if" @keyword @@ -47,7 +47,7 @@ local hl_query = [[ (comment) @comment ]] -local hl_text = [[ +local hl_text_c = [[ /// Schedule Lua callback on main loop's event queue static int nlua_schedule(lua_State *const lstate) { @@ -64,7 +64,7 @@ static int nlua_schedule(lua_State *const lstate) return 0; }]] -local test_text = [[ +local test_text_c = [[ void ui_refresh(void) { int width = INT_MAX, height = INT_MAX; @@ -85,7 +85,7 @@ void ui_refresh(void) } }]] -describe('treesitter highlighting', function() +describe('treesitter highlighting (C)', function() local screen before_each(function() @@ -105,13 +105,13 @@ describe('treesitter highlighting', function() [11] = {foreground = Screen.colors.Cyan4}; } - exec_lua([[ hl_query = ... ]], hl_query) + exec_lua([[ hl_query = ... ]], hl_query_c) command [[ hi link @error ErrorMsg ]] command [[ hi link @warning WarningMsg ]] end) it('is updated with edits', function() - insert(hl_text) + insert(hl_text_c) screen:expect{grid=[[ /// Schedule Lua callback on main loop's event queue | static int nlua_schedule(lua_State *const lstate) | @@ -274,7 +274,7 @@ describe('treesitter highlighting', function() end) it('is updated with :sort', function() - insert(test_text) + insert(test_text_c) exec_lua [[ local parser = vim.treesitter.get_parser(0, "c") test_hl = vim.treesitter.highlighter.new(parser, {queries = {c = hl_query}}) @@ -351,7 +351,7 @@ describe('treesitter highlighting', function() [1] = {bold = true, foreground = Screen.colors.SeaGreen4}; } - insert(test_text) + insert(test_text_c) screen:expect{ grid= [[ int width = INT_MAX, height = INT_MAX; | @@ -510,7 +510,7 @@ describe('treesitter highlighting', function() end) it("supports highlighting with custom highlight groups", function() - insert(hl_text) + insert(hl_text_c) exec_lua [[ local parser = vim.treesitter.get_parser(0, "c") @@ -692,7 +692,7 @@ describe('treesitter highlighting', function() end) it("supports conceal attribute", function() - insert(hl_text) + insert(hl_text_c) -- conceal can be empty or a single cchar. exec_lua [=[ @@ -753,3 +753,65 @@ describe('treesitter highlighting', function() eq(nil, get_hl"@total.nonsense.but.a.lot.of.dots") end) end) + +describe('treesitter highlighting (help)', function() + local screen + + before_each(function() + screen = Screen.new(40, 6) + screen:attach() + 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}; + } + end) + + it("correctly redraws added/removed injections", function() + insert[[ + >ruby + -- comment + local this_is = 'actually_lua' + < + ]] + + exec_lua [[ + vim.bo.filetype = 'help' + vim.treesitter.start() + ]] + + screen:expect{grid=[[ + {1:>ruby} | + {1: -- comment} | + {1: local this_is = 'actually_lua'} | + < | + ^ | + | + ]]} + + helpers.curbufmeths.set_text(0, 1, 0, 5, {'lua'}) + + screen:expect{grid=[[ + {1:>lua} | + {1: -- comment} | + {1: }{3:local}{1: }{4:this_is}{1: }{3:=}{1: }{5:'actually_lua'} | + < | + ^ | + | + ]]} + + helpers.curbufmeths.set_text(0, 1, 0, 4, {'ruby'}) + + screen:expect{grid=[[ + {1:>ruby} | + {1: -- comment} | + {1: local this_is = 'actually_lua'} | + < | + ^ | + | + ]]} + end) + +end) -- cgit From 3836eeb90182cc610ea15bf6bd83cbc720bb7c64 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 12 Aug 2023 18:12:49 +0200 Subject: feat(treesitter): update C queries from upstream --- test/functional/treesitter/highlight_spec.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/functional/treesitter/highlight_spec.lua') diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index dc303c564f..c88c5cd3e5 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -580,9 +580,9 @@ describe('treesitter highlighting (C)', function() -- expect everything to have Constant highlight screen:expect{grid=[[ {12:int}{8: x = INT_MAX;} | - {8:#define READ_STRING(x, y) (char *)read_string((x), (size_t)(y))} | - {8:#define foo void main() { \} | - {8: return 42; \} | + {8:#define READ_STRING(x, y) (}{12:char}{8: *)read_string((x), (}{12:size_t}{8:)(y))} | + {8:#define foo }{12:void}{8: main() { \} | + {8: }{12:return}{8: 42; \} | {8: }} | ^ | {1:~ }| -- cgit From fc0ee871de2f56dbb80879c912203a6372c54e1c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 12 Aug 2023 17:54:04 +0200 Subject: fix(treesitter)!: remove deprecated legacy injection format --- test/functional/treesitter/highlight_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/treesitter/highlight_spec.lua') diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index c88c5cd3e5..0528370e2a 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -442,7 +442,7 @@ describe('treesitter highlighting (C)', function() exec_lua [[ local parser = vim.treesitter.get_parser(0, "c", { - injections = {c = "(preproc_def (preproc_arg) @c) (preproc_function_def value: (preproc_arg) @c)"} + injections = {c = '(preproc_def (preproc_arg) @injection.content (#set! injection.language "c")) (preproc_function_def value: (preproc_arg) @injection.content (#set! injection.language "c"))'} }) local highlighter = vim.treesitter.highlighter test_hl = highlighter.new(parser, {queries = {c = hl_query}}) @@ -480,7 +480,7 @@ describe('treesitter highlighting (C)', function() ]]) exec_lua [[ - local injection_query = "(preproc_def (preproc_arg) @c) (preproc_function_def value: (preproc_arg) @c)" + local injection_query = '(preproc_def (preproc_arg) @injection.content (#set! injection.language "c")) (preproc_function_def value: (preproc_arg) @injection.content (#set! injection.language "c"))' vim.treesitter.query.set("c", "highlights", hl_query) vim.treesitter.query.set("c", "injections", injection_query) -- cgit From 908843df61fc80f160392edc0af0d1672a8f9a68 Mon Sep 17 00:00:00 2001 From: L Lllvvuu Date: Wed, 13 Sep 2023 16:51:54 -0700 Subject: fix(languagetree): apply `resolve_lang` to `metadata['injection.language']` `resolve_lang` is applied to `@injection.language` when it's supplied as a capture: https://github.com/neovim/neovim/blob/f5953edbac14febce9d4f8a3c35bdec1eae26fbe/runtime/lua/vim/treesitter/languagetree.lua#L766-L768 If we want to support `metadata['injection.language']` (as per #22518 and [tree-sitter upstream](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection)) then the behavior should be consistent. Fixes: nvim-treesitter/nvim-treesitter#4918 --- test/functional/treesitter/highlight_spec.lua | 117 +++++++++++++++----------- 1 file changed, 70 insertions(+), 47 deletions(-) (limited to 'test/functional/treesitter/highlight_spec.lua') diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index 0528370e2a..0aa0cdd6d6 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -85,6 +85,56 @@ void ui_refresh(void) } }]] +local injection_text_c = [[ +int x = INT_MAX; +#define READ_STRING(x, y) (char *)read_string((x), (size_t)(y)) +#define foo void main() { \ + return 42; \ + } +]] + +local injection_grid_c = [[ + int x = INT_MAX; | + #define READ_STRING(x, y) (char *)read_string((x), (size_t)(y)) | + #define foo void main() { \ | + return 42; \ | + } | + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | +]] + +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}; \ | + } | + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | +]] + describe('treesitter highlighting (C)', function() local screen @@ -411,34 +461,9 @@ describe('treesitter highlighting (C)', function() end) it("supports injected languages", function() - insert([[ - int x = INT_MAX; - #define READ_STRING(x, y) (char *)read_string((x), (size_t)(y)) - #define foo void main() { \ - return 42; \ - } - ]]) + insert(injection_text_c) - screen:expect{grid=[[ - int x = INT_MAX; | - #define READ_STRING(x, y) (char *)read_string((x), (size_t)(y)) | - #define foo void main() { \ | - return 42; \ | - } | - ^ | - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - | - ]]} + screen:expect{grid=injection_grid_c} exec_lua [[ local parser = vim.treesitter.get_parser(0, "c", { @@ -448,26 +473,24 @@ describe('treesitter highlighting (C)', function() test_hl = highlighter.new(parser, {queries = {c = hl_query}}) ]] - 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:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - | - ]]} + screen:expect{grid=injection_grid_expected_c} + end) + + it("supports injecting by ft name in metadata['injection.language']", function() + insert(injection_text_c) + + screen:expect{grid=injection_grid_c} + + exec_lua [[ + vim.treesitter.language.register("c", "foo") + local parser = vim.treesitter.get_parser(0, "c", { + injections = {c = '(preproc_def (preproc_arg) @injection.content (#set! injection.language "fOO")) (preproc_function_def value: (preproc_arg) @injection.content (#set! injection.language "fOO"))'} + }) + local highlighter = vim.treesitter.highlighter + test_hl = highlighter.new(parser, {queries = {c = hl_query}}) + ]] + + screen:expect{grid=injection_grid_expected_c} end) it("supports overriding queries, like ", function() -- cgit From e353c869cea4541d00d627ec82724d3f247225a3 Mon Sep 17 00:00:00 2001 From: L Lllvvuu Date: Tue, 19 Sep 2023 21:41:07 -0700 Subject: fix(languagetree): don't treat unparsed nodes as occupying full range This is incorrect in the following scenario: 1. The language tree is Lua > Vim > Lua. 2. An edit simultaneously wipes out the `_regions` of all nodes, while taking the Vim injection off-screen. 3. The Vim injection is not re-parsed, so the child Lua `_regions` is still `nil`. 4. The child Lua is assumed, incorrectly, to occupy the whole document. 5. This causes the injections to be parsed again, resulting in Lua > Vim > Lua > Vim. 6. Now, by the same process, Vim ends up with its range assumed over the whole document. Now the parse is broken and results in broken highlighting and poor performance. It should be fine to instead treat an unparsed node as occupying nothing (i.e. effectively non-existent). Since, either: - The parent was just parsed, hence defining `_regions` - The parent was not just parsed, in which case this node doesn't need to be parsed either. Also, the name `has_regions` is confusing; it seems to simply mean the opposite of "root" or "full_document". However, this PR does not touch it. --- test/functional/treesitter/highlight_spec.lua | 64 +++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'test/functional/treesitter/highlight_spec.lua') diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index 0aa0cdd6d6..e037c9e215 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -838,3 +838,67 @@ describe('treesitter highlighting (help)', function() end) end) + +describe('treesitter highlighting (nested injections)', function() + local screen + + before_each(function() + screen = Screen.new(80, 7) + screen:attach() + 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) + + it("correctly redraws nested injections (GitHub #25252)", function() + insert[=[ +function foo() print("Lua!") end + +local lorem = { + ipsum = {}, + bar = {}, +} +vim.cmd([[ + augroup RustLSP + autocmd CursorHold silent! lua vim.lsp.buf.document_highlight() + augroup END +]]) + ]=] + + exec_lua [[ + vim.opt.scrolloff = 0 + vim.bo.filetype = 'lua' + vim.treesitter.start() + ]] + + -- invalidate the language tree + feed("ggi--[[04x") + + screen:expect{grid=[[ + {2:^function} {3:foo}{1:()} {1:print(}{4:"Lua!"}{1:)} {2:end} | + | + {2:local} {3:lorem} {2:=} {1:{} | + {3:ipsum} {2:=} {1:{},} | + {3:bar} {2:=} {1:{},} | + {1:}} | + | + ]]} + + -- spam newline insert/delete to invalidate Lua > Vim > Lua region + feed("3joddkoddkoddkoddk0") + + screen:expect{grid=[[ + {2:function} {3:foo}{1:()} {1:print(}{4:"Lua!"}{1:)} {2:end} | + | + {2:local} {3:lorem} {2:=} {1:{} | + ^ {3:ipsum} {2:=} {1:{},} | + {3:bar} {2:=} {1:{},} | + {1:}} | + | + ]]} + end) + +end) -- cgit