Fix typescript-ts-mode indentation for switch statements
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): Add indentation rule for switch case and default keywords. (Bug#67488)
This commit is contained in:
parent
ab9c62c2b3
commit
ab12628408
2 changed files with 20 additions and 0 deletions
|
@ -107,6 +107,9 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
|||
((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)
|
||||
|
|
|
@ -45,6 +45,23 @@ const foo = () => {
|
|||
};
|
||||
=-=-=
|
||||
|
||||
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)
|
||||
|
|
Loading…
Add table
Reference in a new issue