GNU bug report logs -
#79465
js-ts-mode treesit-thing-settings
Previous Next
To reply to this bug, email your comments to 79465 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
casouri <at> gmail.com, bug-gnu-emacs <at> gnu.org
:
bug#79465
; Package
emacs
.
(Thu, 18 Sep 2025 06:53:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> linkov.net>
:
New bug report received and forwarded. Copy sent to
casouri <at> gmail.com, bug-gnu-emacs <at> gnu.org
.
(Thu, 18 Sep 2025 06:53:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
While improving treesit-things for ts-modes,
I hesitated to change js--treesit-thing-settings,
but now don't see a problem with adapting the same rule
as already used by c-ts-mode for a long time that
matches all nodes except "{" "}" "[" "]" "(" ")" ",".
The problem is that the existing 'js--treesit-sexp-nodes'
is a list of nodes joined together by 'js--regexp-opt-symbol',
whereas the new definition is a sexp matcher.
Therefore we could make the internal variable
'js--treesit-sexp-nodes' obsolete like in this patch:
[js--treesit-thing-settings.patch (text/x-diff, inline)]
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 00c57b72e18..0fda7d62145 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3949,38 +3949,11 @@ js--treesit-sentence-nodes
"Nodes that designate sentences in JavaScript.
See `treesit-thing-settings' for more information.")
-(defvar js--treesit-sexp-nodes
- '("expression"
- "parenthesized_expression"
- "formal_parameters"
- "pattern"
- "array"
- "function"
- "string"
- "template_string"
- "template_substitution"
- "escape"
- "template"
- "regex"
- "number"
- "identifier"
- "property_identifier"
- "this"
- "super"
- "true"
- "false"
- "null"
- "undefined"
- "arguments"
- "pair"
- "jsx"
- "statement_block"
- "object"
- "object_pattern"
- "named_imports"
- "class_body")
+(defvar js--treesit-sexp-nodes nil
"Nodes that designate sexps in JavaScript.
See `treesit-thing-settings' for more information.")
+(make-obsolete 'js--treesit-sexp-nodes
+ "`js--treesit-sexp-nodes' will be removed soon, use `js--treesit-thing-settings' instead." "31.1")
(defvar js--treesit-list-nodes
'("export_clause"
@@ -4011,7 +3984,13 @@ js--treesit-jsdoc-beginning-regexp
(defvar js--treesit-thing-settings
`((javascript
- (sexp ,(js--regexp-opt-symbol js--treesit-sexp-nodes))
+ (sexp ,(if js--treesit-sexp-nodes
+ (js--regexp-opt-symbol js--treesit-sexp-nodes)
+ `(not (or (and named
+ ,(rx bos (or "program" "comment") eos))
+ (and anonymous
+ ,(rx (or "{" "}" "[" "]"
+ "(" ")" ",")))))))
(list ,(js--regexp-opt-symbol js--treesit-list-nodes))
(sentence ,(js--regexp-opt-symbol js--treesit-sentence-nodes))
(text ,(js--regexp-opt-symbol '("comment"
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.