From 28233bcb49067aaa70fa6e5fec14e2cc4bcaa315 Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Fri, 15 Sep 2023 03:10:55 -0700 Subject: refactor(treesitter): rename "preview" => "edit" #25161 "Edit" more closely describes the generic application than "Preview", though the buffer contents don't (yet) map to an actual file on disk. https://github.com/neovim/neovim/pull/24703#discussion_r1321719133 --- runtime/doc/news.txt | 2 +- runtime/doc/treesitter.txt | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 9adc90ac21..0162a99619 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -135,7 +135,7 @@ The following new APIs and features were added. `vim.treesitter.language.register`. • The `#set!` directive now supports `injection.self` and `injection.parent` for injecting either the current node's language or the parent LanguageTree's language, respectively. - • Added `vim.treesitter.preview_query()`, for live editing of treesitter + • Added `vim.treesitter.query.edit()`, for live editing of treesitter queries. • Improved error messages for query parsing. diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index c62e210be1..64b4ca7ca2 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -676,8 +676,8 @@ inspect_tree({opts}) *vim.treesitter.inspect_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, "o" to toggle - the query previewer, and press to jump to the node under the - cursor in the source buffer. + the query editor, and press to jump to the node under the cursor + in the source buffer. Can also be shown with `:InspectTree`. *:InspectTree* @@ -730,11 +730,6 @@ node_contains({node}, {range}) *vim.treesitter.node_contains()* Return: ~ (boolean) True if the {node} contains the {range} -preview_query() *vim.treesitter.preview_query()* - Open a window for live editing of a treesitter query. - - Can also be shown with `:PreviewQuery`. *:PreviewQuery* - start({bufnr}, {lang}) *vim.treesitter.start()* Starts treesitter highlighting for a buffer @@ -858,6 +853,14 @@ add_predicate({name}, {handler}, {force}) meanings • {force} (boolean|nil) +edit() *vim.treesitter.query.edit()* + Open a window for live editing of a treesitter query. + + Can also be shown with `:EditQuery`. *:EditQuery* + + Note that the editor opens a scratch buffer, and so queries aren't + persisted on disk. + get({lang}, {query_name}) *vim.treesitter.query.get()* Returns the runtime query {query_name} for {lang}. -- cgit