aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter.lua
diff options
context:
space:
mode:
authorMaria José Solano <majosolano99@gmail.com>2023-08-25 11:17:36 -0700
committerGitHub <noreply@github.com>2023-08-25 13:17:36 -0500
commit5d8ab32f3871b0232972cac1116ac7cba98389e5 (patch)
tree6333dd11015b7d863f2ccd1c105524809f9f482d /runtime/lua/vim/treesitter.lua
parentecd99e7dd7383b708d9235e5b3d398b0216d65c7 (diff)
downloadrneovim-5d8ab32f3871b0232972cac1116ac7cba98389e5.tar.gz
rneovim-5d8ab32f3871b0232972cac1116ac7cba98389e5.tar.bz2
rneovim-5d8ab32f3871b0232972cac1116ac7cba98389e5.zip
feat(treesitter): add a query editor (#24703)
Diffstat (limited to 'runtime/lua/vim/treesitter.lua')
-rw-r--r--runtime/lua/vim/treesitter.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index 04420c81e3..4f84fc2e0f 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -472,8 +472,8 @@ end
--- Open a window that displays a textual representation of the nodes in the language tree.
---
--- While in the window, press "a" to toggle display of anonymous nodes, "I" to toggle the
---- display of the source language of each node, and press <Enter> to jump to the node under the
---- cursor in the source buffer.
+--- display of the source language of each node, "o" to toggle the query previewer, and press
+--- <Enter> to jump to the node under the cursor in the source buffer.
---
--- Can also be shown with `:InspectTree`. *:InspectTree*
---
@@ -494,6 +494,13 @@ function M.inspect_tree(opts)
require('vim.treesitter.dev').inspect_tree(opts)
end
+--- Open a window for live editing of a treesitter query.
+---
+--- Can also be shown with `:PreviewQuery`. *:PreviewQuery*
+function M.preview_query()
+ require('vim.treesitter.dev').preview_query()
+end
+
--- Returns the fold level for {lnum} in the current buffer. Can be set directly to 'foldexpr':
--- <pre>lua
--- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'