* lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): Add
indentation rule for switch case and default keywords. (Bug#67488)
((parent-is "member_expression") parent-bol typescript-ts-mode-indent-offset)
((parent-is "named_imports") parent-bol typescript-ts-mode-indent-offset)
((parent-is "statement_block") parent-bol typescript-ts-mode-indent-offset)
+ ((or (node-is "case")
+ (node-is "default"))
+ parent-bol typescript-ts-mode-indent-offset)
((parent-is "switch_case") parent-bol typescript-ts-mode-indent-offset)
((parent-is "switch_default") parent-bol typescript-ts-mode-indent-offset)
((parent-is "type_arguments") parent-bol typescript-ts-mode-indent-offset)
};
=-=-=
+Name: Switch statement
+
+=-=
+const foo = (x: string) => {
+ switch (x) {
+ case "a":
+ console.log(x);
+ return 1;
+ case "b":
+ return 2;
+ case "c":
+ default:
+ return 0;
+ }
+};
+=-=-=
+
Code:
(lambda ()
(setq indent-tabs-mode nil)