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
This commit is contained in:
Maria José Solano
2023-09-15 03:10:55 -07:00
committed by GitHub
parent 2d9e7a33f4
commit 28233bcb49
6 changed files with 48 additions and 43 deletions

View File

@@ -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.

View File

@@ -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 <Enter> to jump to the node under the
cursor in the source buffer.
the query editor, and press <Enter> 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}.