aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJackson Ray Hamilton2025-11-14 22:27:34 -0800
committerJackson Ray Hamilton2025-11-14 22:32:15 -0800
commit9b3eb06c76e9937384dfb82dde41d4d7fc9b9683 (patch)
treed17f1d25c50a8afe40a83a38f76181e4a50e3daf
parent1c87be8ac956538c70ba9bdce7403f08d511984d (diff)
downloademacs-9b3eb06c76e9937384dfb82dde41d4d7fc9b9683.tar.gz
emacs-9b3eb06c76e9937384dfb82dde41d4d7fc9b9683.zip
Indent jsx_text properly with modern grammars
* lisp/progmodes/js.el: * lisp/progmodes/typescript-ts-mode.el: Indent jsx_text from correct column when a modern grammar is installed; previously was over-indented.
-rw-r--r--lisp/progmodes/js.el2
-rw-r--r--lisp/progmodes/typescript-ts-mode.el2
2 files changed, 2 insertions, 2 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index edb77db9bfe..1124e915737 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3448,7 +3448,7 @@ Check if a node type is available, then return the right indent rules."
3448 ((parent-is "jsx_fragment") parent js-indent-level))) 3448 ((parent-is "jsx_fragment") parent js-indent-level)))
3449 (error 3449 (error
3450 `(((match "<" "jsx_text") parent 0) 3450 `(((match "<" "jsx_text") parent 0)
3451 ((parent-is "jsx_text") parent js-indent-level))))) 3451 ((parent-is "jsx_text") parent-bol js-indent-level)))))
3452 3452
3453(defvar js--treesit-indent-rules 3453(defvar js--treesit-indent-rules
3454 (let ((switch-case (rx "switch_" (or "case" "default")))) 3454 (let ((switch-case (rx "switch_" (or "case" "default"))))
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index 72b9d31204c..1a033070f1d 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -93,7 +93,7 @@ Check if a node type is available, then return the right indent rules."
93 ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset))) 93 ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset)))
94 (treesit-query-error 94 (treesit-query-error
95 `(((match "<" "jsx_text") parent 0) 95 `(((match "<" "jsx_text") parent 0)
96 ((parent-is "jsx_text") parent typescript-ts-mode-indent-offset))))) 96 ((parent-is "jsx_text") parent-bol typescript-ts-mode-indent-offset)))))
97 97
98(defun typescript-ts-mode--anchor-decl (_n parent &rest _) 98(defun typescript-ts-mode--anchor-decl (_n parent &rest _)
99 "Return the position after the declaration keyword before PARENT. 99 "Return the position after the declaration keyword before PARENT.