1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Add a synchronous way to get parser change ranges (bug#78402)

This commit only adds the new function, the fix for the bug is
in the next commit.

* doc/lispref/parsing.texi (Using Parser): Add docs.
* lisp/treesit.el (treesit): Add shortdoc.
* src/treesit.c (treesit_get_affected_ranges): New function
extracted from treesit_call_after_change_functions.
(treesit_call_after_change_functions): Extract out.
(treesit_ensure_parsed): Return affected regions.
(Ftreesit_parser_changed_regions): New function that returns the
affected regions.
This commit is contained in:
Yuan Fu 2025-07-08 23:14:20 -07:00
parent c4674bfa3a
commit 564b947745
No known key found for this signature in database
GPG key ID: 56E19BC57664A442
3 changed files with 60 additions and 10 deletions

View file

@ -5439,6 +5439,19 @@ Tree-sitter grammar for `%s' is missing; install it?"
(treesit-parser-language
:no-eval (treesit-parser-language parser)
:eg-result c)
(treesit-parser-tag
:no-eval (treesit-parser-tag parser)
:eg-result 'embeded)
(treesit-parser-changed-regions
:no-eval (treesit-parser-changed-regions parser)
:eg-result '((1 . 10) (24 . 58)))
(treesit-parser-embed-level
:no-eval (treesit-parser-embed-level parser)
:eg-result 1)
(treesit-parser-set-embed-level
:no-eval (treesit-parser-set-embed-level parser 1))
(treesit-parser-add-notifier)
(treesit-parser-remove-notifier)
(treesit-parser-notifiers