diff options
author | Maria José Solano <majosolano99@gmail.com> | 2025-01-28 23:59:28 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-29 08:59:28 +0100 |
commit | da0ae953490098c28bad4791e08e2cc4c2e385e2 (patch) | |
tree | 5794f7a7ed0f8a671d000f2d495103af7a38cdff /runtime/doc | |
parent | 6711fa27ca6e822bfd2394ec513671617cc53efd (diff) | |
download | rneovim-da0ae953490098c28bad4791e08e2cc4c2e385e2.tar.gz rneovim-da0ae953490098c28bad4791e08e2cc4c2e385e2.tar.bz2 rneovim-da0ae953490098c28bad4791e08e2cc4c2e385e2.zip |
feat(treesitter): support modelines in `query.set()` (#30257)
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/news.txt | 2 | ||||
-rw-r--r-- | runtime/doc/treesitter.txt | 16 |
2 files changed, 15 insertions, 3 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 1dee72314a..65417971ab 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -376,6 +376,8 @@ TREESITTER child that contains a given node as descendant. • |LanguageTree:parse()| optionally supports asynchronous invocation, which is activated by passing the `on_parse` callback parameter. +• |vim.treesitter.query.set()| can now inherit and/or extend runtime file + queries in addition to overriding. TUI diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index d87439a1e0..df974d750c 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -1349,7 +1349,7 @@ parse({lang}, {query}) *vim.treesitter.query.parse()* `info.captures`). • `info.patterns`: information about predicates. - Example (to try it, use `g==` or select the code then run `:'<,'>lua`): >lua + Example: >lua local query = vim.treesitter.query.parse('vimdoc', [[ ; query ((h1) @str @@ -1466,8 +1466,18 @@ Query:iter_matches({node}, {source}, {start}, {stop}, {opts}) set({lang}, {query_name}, {text}) *vim.treesitter.query.set()* Sets the runtime query named {query_name} for {lang} - This allows users to override any runtime files and/or configuration set - by plugins. + This allows users to override or extend any runtime files and/or + configuration set by plugins. + + For example, you could enable spellchecking of `C` identifiers with the + following code: >lua + vim.treesitter.query.set( + 'c', + 'highlights', + [[;inherits c + (identifier) @spell]]) + ]]) +< Parameters: ~ • {lang} (`string`) Language to use for the query |