mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
feat(treesitter): allow passing lang to InspectTree
This commit is contained in:

committed by
Christian Clason

parent
092529ebbf
commit
a94a2927d0
@@ -9,17 +9,17 @@ do
|
||||
end, { desc = 'Inspect highlights and extmarks at the cursor', bang = true })
|
||||
|
||||
vim.api.nvim_create_user_command('InspectTree', function(cmd)
|
||||
local opts = { lang = cmd.fargs[1] }
|
||||
|
||||
if cmd.mods ~= '' or cmd.count ~= 0 then
|
||||
local count = cmd.count ~= 0 and cmd.count or ''
|
||||
local new = cmd.mods ~= '' and 'new' or 'vnew'
|
||||
|
||||
vim.treesitter.inspect_tree({
|
||||
command = ('%s %s%s'):format(cmd.mods, count, new),
|
||||
})
|
||||
else
|
||||
vim.treesitter.inspect_tree()
|
||||
opts.command = ('%s %s%s'):format(cmd.mods, count, new)
|
||||
end
|
||||
end, { desc = 'Inspect treesitter language tree for buffer', count = true })
|
||||
|
||||
vim.treesitter.inspect_tree(opts)
|
||||
end, { desc = 'Inspect treesitter language tree for buffer', count = true, nargs = '?' })
|
||||
|
||||
vim.api.nvim_create_user_command('EditQuery', function(cmd)
|
||||
vim.treesitter.query.edit(cmd.fargs[1])
|
||||
|
Reference in New Issue
Block a user