summaryrefslogtreecommitdiff
path: root/src/treesit.h
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2022-11-15 02:16:11 -0800
committerYuan Fu <casouri@gmail.com>2022-11-15 02:16:11 -0800
commit34e50dc4a23505dce0499f120477e2e1a1327432 (patch)
treea2b38e7fee7a74c9af19d78886f313155aa4853f /src/treesit.h
parent06db8015ea05cc17efb16684de23533ee315be61 (diff)
downloademacs-34e50dc4a23505dce0499f120477e2e1a1327432.tar.gz
Allow tree-sitter to notify parse-tree changes
* src/treesit.c (treesit_call_after_change_functions): New function. (treesit_ensure_parsed): Call treesit_call_after_change_functions right after re-parse. (make_treesit_parser): Initialize after_change_functions. (Ftreesit_parser_notifiers) (Ftreesit_parser_add_notifier) (Ftreesit_parser_remove_notifier): New functions. * src/treesit.h (Lisp_TS_Parser): New field after_change_functions.
Diffstat (limited to 'src/treesit.h')
-rw-r--r--src/treesit.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/treesit.h b/src/treesit.h
index 169d8819d77..2d2a91cd366 100644
--- a/src/treesit.h
+++ b/src/treesit.h
@@ -33,6 +33,10 @@ struct Lisp_TS_Parser
/* A symbol representing the language this parser uses. See the
manual for more explanation. */
Lisp_Object language_symbol;
+ /* A list of functions to call after re-parse. Every function is
+ called with the changed ranges and the parser. The changed
+ ranges is a list of (BEG . END). */
+ Lisp_Object after_change_functions;
/* The buffer associated with this parser. */
Lisp_Object buffer;
/* The pointer to the tree-sitter parser. Never NULL. */