aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/comment_spec.lua
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2025-05-29 12:10:07 +0200
committerGitHub <noreply@github.com>2025-05-29 12:10:07 +0200
commitcc264d51aba802d7f536cc3680b3af2d13ed1889 (patch)
tree6e97f21890f9e26d6c85cfa242131a50ddf438b6 /test/functional/lua/comment_spec.lua
parent6c4ddf607f0b0b4b72c4a949d796853aa77db08f (diff)
downloadrneovim-cc264d51aba802d7f536cc3680b3af2d13ed1889.tar.gz
rneovim-cc264d51aba802d7f536cc3680b3af2d13ed1889.tar.bz2
rneovim-cc264d51aba802d7f536cc3680b3af2d13ed1889.zip
test(treesitter): coverage for comments with combined injections (#33975)
Diffstat (limited to 'test/functional/lua/comment_spec.lua')
-rw-r--r--test/functional/lua/comment_spec.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/functional/lua/comment_spec.lua b/test/functional/lua/comment_spec.lua
index 3284276b32..518abc84dd 100644
--- a/test/functional/lua/comment_spec.lua
+++ b/test/functional/lua/comment_spec.lua
@@ -721,6 +721,39 @@ describe('commenting', function()
'EOF',
}, get_lines())
end)
+
+ it('works across combined injections #30799', function()
+ exec_lua [=[
+ vim.treesitter.query.set('lua', 'injections', [[
+ ((function_call
+ name: (_) @_vimcmd_identifier
+ arguments: (arguments
+ (string
+ content: _ @injection.content)))
+ (#eq? @_vimcmd_identifier "vim.cmd")
+ (#set! injection.language "vim")
+ (#set! injection.combined))
+ ]])
+ ]=]
+
+ api.nvim_set_option_value('filetype', 'lua', { buf = 0 })
+ exec_lua('vim.treesitter.start()')
+
+ local lines = {
+ 'vim.cmd([[" some text]])',
+ 'local a = 123',
+ 'vim.cmd([[" some more text]])',
+ }
+ set_lines(lines)
+
+ set_cursor(2, 0)
+ feed('gcc')
+ eq({
+ 'vim.cmd([[" some text]])',
+ '-- local a = 123',
+ 'vim.cmd([[" some more text]])',
+ }, get_lines())
+ end)
end)
describe('Textobject', function()