[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master ad26461b48d 3/6: Merge from savannah/emacs-29
From: |
Po Lu |
Subject: |
master ad26461b48d 3/6: Merge from savannah/emacs-29 |
Date: |
Thu, 23 Nov 2023 19:48:04 -0500 (EST) |
branch: master
commit ad26461b48ddc6d8d07e818b0536674f73f41b22
Merge: 37b18d88bbc 9af03e0e189
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Merge from savannah/emacs-29
9af03e0e189 typescript-ts-mode: Support indentation for conditionals ...
---
lisp/progmodes/typescript-ts-mode.el | 5 +++++
.../typescript-ts-mode-resources/indent.erts | 22 ++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/lisp/progmodes/typescript-ts-mode.el
b/lisp/progmodes/typescript-ts-mode.el
index b976145dbf3..b6d5495adbb 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -124,6 +124,11 @@ Argument LANGUAGE is either `typescript' or `tsx'."
((parent-is "arrow_function") parent-bol typescript-ts-mode-indent-offset)
((parent-is "parenthesized_expression") parent-bol
typescript-ts-mode-indent-offset)
((parent-is "binary_expression") parent-bol
typescript-ts-mode-indent-offset)
+ ((match "while" "do_statement") parent-bol 0)
+ ((match "else" "if_statement") parent-bol 0)
+ ((parent-is ,(rx (or (seq (or "if" "for" "for_in" "while" "do")
"_statement")
+ "else_clause")))
+ parent-bol typescript-ts-mode-indent-offset)
,@(when (eq language 'tsx)
(append (tsx-ts-mode--indent-compatibility-b893426)
diff --git a/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts
b/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts
index 146ee76574e..20f423259b4 100644
--- a/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts
@@ -23,6 +23,28 @@ const foo = () => {
}
=-=-=
+Name: Statement indentation without braces
+
+=-=
+const foo = () => {
+ if (true)
+ console.log("if_statement");
+ else if (false)
+ console.log("if_statement");
+ else
+ console.log("else_clause");
+ for (let i = 0; i < 1; i++)
+ console.log("for_statement");
+ for (let i of [true])
+ console.log("for_in_statement");
+ while (false)
+ console.log("while_statement");
+ do
+ console.log("do_statement");
+ while (false)
+};
+=-=-=
+
Code:
(lambda ()
(setq indent-tabs-mode nil)
- master updated (29d42d9158a -> 354a2958f9a), Po Lu, 2023/11/23
- master 37b18d88bbc 2/6: ; Merge from savannah/emacs-29, Po Lu, 2023/11/23
- master ad26461b48d 3/6: Merge from savannah/emacs-29,
Po Lu <=
- master 1737ffd3a83 5/6: Merge from savannah/emacs-29, Po Lu, 2023/11/23
- master 354a2958f9a 6/6: ; Complete merge of emoji.el, Po Lu, 2023/11/23
- master cd263043538 4/6: ; Merge from savannah/emacs-29, Po Lu, 2023/11/23
- master 9db8c349f06 1/6: Merge from savannah/emacs-29, Po Lu, 2023/11/23