aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorNoah Peart2023-11-21 15:59:48 +0200
committerDmitry Gutov2023-11-21 16:26:54 +0200
commit9af03e0e1897bce2fce71b79549d4461d7ea1dad (patch)
tree4f2903b14f6543c23f50ddd758f30b16a7c91635 /lisp
parent61cdf42a48fab24b7ee4098ffedf7254080f808b (diff)
downloademacs-9af03e0e1897bce2fce71b79549d4461d7ea1dad.tar.gz
emacs-9af03e0e1897bce2fce71b79549d4461d7ea1dad.zip
typescript-ts-mode: Support indentation for conditionals without braces
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--indent-rules): Support indentation for conditionals without braces (bug#67031). * test/lisp/progmodes/typescript-ts-mode-resources/indent.erts (Statement indentation without braces): New test.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/typescript-ts-mode.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index ec220ab8d03..4e039abd236 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'."
124 ((parent-is "arrow_function") parent-bol typescript-ts-mode-indent-offset) 124 ((parent-is "arrow_function") parent-bol typescript-ts-mode-indent-offset)
125 ((parent-is "parenthesized_expression") parent-bol typescript-ts-mode-indent-offset) 125 ((parent-is "parenthesized_expression") parent-bol typescript-ts-mode-indent-offset)
126 ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent-offset) 126 ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent-offset)
127 ((match "while" "do_statement") parent-bol 0)
128 ((match "else" "if_statement") parent-bol 0)
129 ((parent-is ,(rx (or (seq (or "if" "for" "for_in" "while" "do") "_statement")
130 "else_clause")))
131 parent-bol typescript-ts-mode-indent-offset)
127 132
128 ,@(when (eq language 'tsx) 133 ,@(when (eq language 'tsx)
129 (append (tsx-ts-mode--indent-compatibility-b893426) 134 (append (tsx-ts-mode--indent-compatibility-b893426)