diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-07-03 07:40:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-03 07:40:42 +0800 |
commit | d413038b4fd71b7a335b6653aa64d2cb6daeac7b (patch) | |
tree | 6f6cc9e09bb6a3b4aecdb64d761bc93e5730dd88 /test/functional/treesitter/highlight_spec.lua | |
parent | aec7f1979ada1b34cfb3d8fd33769232d0323ea8 (diff) | |
download | rneovim-d413038b4fd71b7a335b6653aa64d2cb6daeac7b.tar.gz rneovim-d413038b4fd71b7a335b6653aa64d2cb6daeac7b.tar.bz2 rneovim-d413038b4fd71b7a335b6653aa64d2cb6daeac7b.zip |
fix(treesitter): ensure syntaxset augroup exists (#29542)
Problem:
Error when calling vim.treesitter.start() and vim.treesitter.stop() in
init.lua.
Solution:
Ensure syntaxset augroup exists after loading synload.vim.
Diffstat (limited to 'test/functional/treesitter/highlight_spec.lua')
-rw-r--r-- | test/functional/treesitter/highlight_spec.lua | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index 05c0cdc01e..6eadb3110f 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -10,8 +10,6 @@ local command = n.command local api = n.api local eq = t.eq -before_each(clear) - local hl_query_c = [[ (ERROR) @error @@ -120,6 +118,7 @@ describe('treesitter highlighting (C)', function() local screen before_each(function() + clear() screen = Screen.new(65, 18) screen:attach() screen:set_default_attr_ids { @@ -800,6 +799,7 @@ describe('treesitter highlighting (lua)', function() local screen before_each(function() + clear() screen = Screen.new(65, 18) screen:attach() screen:set_default_attr_ids { @@ -838,6 +838,7 @@ describe('treesitter highlighting (help)', function() local screen before_each(function() + clear() screen = Screen.new(40, 6) screen:attach() screen:set_default_attr_ids { @@ -939,6 +940,7 @@ describe('treesitter highlighting (nested injections)', function() local screen before_each(function() + clear() screen = Screen.new(80, 7) screen:attach() screen:set_default_attr_ids { @@ -1006,6 +1008,7 @@ describe('treesitter highlighting (markdown)', function() local screen before_each(function() + clear() screen = Screen.new(40, 6) screen:attach() exec_lua([[ @@ -1053,3 +1056,19 @@ printf('Hello World!'); }) end) end) + +it('starting and stopping treesitter highlight in init.lua works #29541', function() + t.write_file( + 'Xinit.lua', + [[ + vim.bo.ft = 'c' + vim.treesitter.start() + vim.treesitter.stop() + ]] + ) + finally(function() + os.remove('Xinit.lua') + end) + clear({ args = { '-u', 'Xinit.lua' } }) + eq('', api.nvim_get_vvar('errmsg')) +end) |