GNU bug report logs -
#66988
30.0.50; treesit-forward-sexp not working properly in js-ts-mode and tsx-ts-mode
Previous Next
Reported by: Loïc Lemaître <loic.lemaitre <at> gmail.com>
Date: Tue, 7 Nov 2023 16:20:01 UTC
Severity: normal
Found in version 30.0.50
Fixed in version 30.1
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> @@ -3843,6 +3843,7 @@ js--treesit-sexp-nodes
> "undefined"
> "arguments"
> "pair"
> + "parenthesized_expression"
> "jsx")
> "Nodes that designate sexps in JavaScript.
> See `treesit-thing-settings' for more information.")
I had the same problem and to make this mode more usable had to use such patch:
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 5a669fdbd42..4c07fbd94b7 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3825,7 +3825,9 @@ js--treesit-sentence-nodes
See `treesit-thing-settings' for more information.")
(defvar js--treesit-sexp-nodes
- '("expression"
+ '("expression" ;; SHOULD NOT MATCH "expression_statement", BUT SHOULD MATCH "parenthesized_expression"
+ "parenthesized_expression"
+ "formal_parameters"
"pattern"
"array"
"function"
@@ -3843,7 +3845,13 @@ js--treesit-sexp-nodes
"undefined"
"arguments"
"pair"
- "jsx")
+ "jsx"
+ "statement_block"
+ "object"
+ "object_pattern"
+ "named_imports"
+ "class_body"
+ )
"Nodes that designate sexps in JavaScript.
See `treesit-thing-settings' for more information.")
PS:
Also tried to replace
(setq-local treesit-sexp-type-regexp (regexp-opt js--treesit-sexp-nodes))
with
(setq-local treesit-sexp-type-regexp (rx-to-string `(seq bol (or ,@js--treesit-sexp-nodes) eol)))
This bug report was last modified 1 year and 127 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.