[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/tree-sitter 3a0c94ac0b 1/4: Remove feature that checks whether t
From: |
Yuan Fu |
Subject: |
feature/tree-sitter 3a0c94ac0b 1/4: Remove feature that checks whether tree-sitter node "has changes" |
Date: |
Mon, 14 Nov 2022 04:24:35 -0500 (EST) |
branch: feature/tree-sitter
commit 3a0c94ac0b5d5098f9140c5ab4231d6dd06ec393
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Remove feature that checks whether tree-sitter node "has changes"
First of all, we signal error on using an outdated node, so if a node
has changes, calling treesit-node-check would only raise an error.
Besides, in order to properly answer whether a node has changed, we
would have to update the node as the buffer is edited, which we don't
do right now.
* doc/lispref/parsing.texi (Accessing Node Information): Remove
relevant manual text.
* src/treesit.c (Ftreesit_node_check): Remove docstring mentions,
remove the branch for "has-changes".
(syms_of_treesit): Remove has-changes.
---
doc/lispref/parsing.texi | 11 +++--------
src/treesit.c | 10 ++--------
2 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi
index 2c838e317e..9fcf488da1 100644
--- a/doc/lispref/parsing.texi
+++ b/doc/lispref/parsing.texi
@@ -875,11 +875,6 @@ is not yet in its final form.
A node can be ``extra'': such nodes represent things like comments,
which can appear anywhere in the text.
-@cindex tree-sitter node that has changes
-@cindex has changes, tree-sitter node
-A node ``has changes'' if the buffer changed since the last time the
-node was retrieved, i.e., the node is outdated.
-
@cindex tree-sitter node that has error
@cindex has error, tree-sitter node
A node ``has error'' if the text it spans contains a syntax error. It
@@ -888,8 +883,8 @@ has an error.
@defun treesit-node-check node property
This function checks if @var{node} has the specified @var{property}.
-@var{property} can be @code{named}, @code{missing}, @code{extra},
-@code{has-changes}, or @code{has-error}.
+@var{property} can be @code{named}, @code{missing}, @code{extra}, or
+@code{has-error}.
@end defun
@defun treesit-node-type node
@@ -1749,7 +1744,7 @@ ts_node_is_null
ts_node_is_named treesit-node-check
ts_node_is_missing treesit-node-check
ts_node_is_extra treesit-node-check
-ts_node_has_changes treesit-node-check
+ts_node_has_changes
ts_node_has_error treesit-node-check
ts_node_parent treesit-node-parent
ts_node_child treesit-node-child
diff --git a/src/treesit.c b/src/treesit.c
index 86328ae03e..602554daa0 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -1629,7 +1629,7 @@ DEFUN ("treesit-node-check",
Ftreesit_node_check, Streesit_node_check, 2, 2, 0,
doc: /* Return non-nil if NODE has PROPERTY, nil otherwise.
-PROPERTY could be `named', `missing', `extra', `has-changes', or `has-error'.
+PROPERTY could be `named', `missing', `extra', or `has-error'.
Named nodes correspond to named rules in the language definition,
whereas "anonymous" nodes correspond to string literals in the
@@ -1641,9 +1641,6 @@ certain kinds of syntax errors, i.e., should be there but
not there.
Extra nodes represent things like comments, which are not required the
language definition, but can appear anywhere.
-A node "has changes" if the buffer changed since the node is
-created. (Don't forget the "s" at the end of `has-changes'.)
-
A node "has error" if itself is a syntax error or contains any syntax
errors. */)
(Lisp_Object node, Lisp_Object property)
@@ -1663,11 +1660,9 @@ errors. */)
result = ts_node_is_extra (treesit_node);
else if (EQ (property, Qhas_error))
result = ts_node_has_error (treesit_node);
- else if (EQ (property, Qhas_changes))
- result = ts_node_has_changes (treesit_node);
else
signal_error ("Expecting `named', `missing', `extra', "
- "`has-changes' or `has-error', but got",
+ "or `has-error', but got",
property);
return result ? Qt : Qnil;
}
@@ -2829,7 +2824,6 @@ syms_of_treesit (void)
DEFSYM (Qnamed, "named");
DEFSYM (Qmissing, "missing");
DEFSYM (Qextra, "extra");
- DEFSYM (Qhas_changes, "has-changes");
DEFSYM (Qhas_error, "has-error");
DEFSYM (Qnot_found, "not-found");