From 9b3eb06c76e9937384dfb82dde41d4d7fc9b9683 Mon Sep 17 00:00:00 2001 From: Jackson Ray Hamilton Date: Fri, 14 Nov 2025 22:27:34 -0800 Subject: [PATCH] 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. --- lisp/progmodes/js.el | 2 +- lisp/progmodes/typescript-ts-mode.el | 2 +- 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." ((parent-is "jsx_fragment") parent js-indent-level))) (error `(((match "<" "jsx_text") parent 0) - ((parent-is "jsx_text") parent js-indent-level))))) + ((parent-is "jsx_text") parent-bol js-indent-level))))) (defvar js--treesit-indent-rules (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." ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset))) (treesit-query-error `(((match "<" "jsx_text") parent 0) - ((parent-is "jsx_text") parent typescript-ts-mode-indent-offset))))) + ((parent-is "jsx_text") parent-bol typescript-ts-mode-indent-offset))))) (defun typescript-ts-mode--anchor-decl (_n parent &rest _) "Return the position after the declaration keyword before PARENT.