diff options
| author | Riley Bruins <ribru17@hotmail.com> | 2025-01-29 15:53:34 -0800 |
|---|---|---|
| committer | Riley Bruins <ribru17@hotmail.com> | 2025-02-02 12:13:25 -0800 |
| commit | 8543aa406c4ae88cc928372b2f8105005cdd0a80 (patch) | |
| tree | afec92c5aac4ac78ace7720926075fbb34a82a86 /runtime/doc | |
| parent | 9508d6a8146350ffc9f31f4263fa871bab9130bf (diff) | |
| download | rneovim-8543aa406c4ae88cc928372b2f8105005cdd0a80.tar.gz rneovim-8543aa406c4ae88cc928372b2f8105005cdd0a80.tar.bz2 rneovim-8543aa406c4ae88cc928372b2f8105005cdd0a80.zip | |
feat(treesitter): allow LanguageTree:is_valid() to accept a range
When given, only that range will be checked for validity rather than the
entire tree. This is used in the highlighter to save CPU cycles since we
only need to parse a certain region at a time anyway.
Diffstat (limited to 'runtime/doc')
| -rw-r--r-- | runtime/doc/news.txt | 2 | ||||
| -rw-r--r-- | runtime/doc/treesitter.txt | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 2208428f75..e03d6ca512 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -379,6 +379,8 @@ TREESITTER 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. +• |LanguageTree:is_valid()| now accepts a range parameter to narrow the scope + of the validity check. TUI diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 257a6a24e7..b04f13add5 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -1581,7 +1581,8 @@ LanguageTree:invalidate({reload}) *LanguageTree:invalidate()* Parameters: ~ • {reload} (`boolean?`) -LanguageTree:is_valid({exclude_children}) *LanguageTree:is_valid()* + *LanguageTree:is_valid()* +LanguageTree:is_valid({exclude_children}, {range}) Returns whether this LanguageTree is valid, i.e., |LanguageTree:trees()| reflects the latest state of the source. If invalid, user should call |LanguageTree:parse()|. @@ -1589,6 +1590,7 @@ LanguageTree:is_valid({exclude_children}) *LanguageTree:is_valid()* Parameters: ~ • {exclude_children} (`boolean?`) whether to ignore the validity of children (default `false`) + • {range} (`Range?`) range to check for validity Return: ~ (`boolean`) |