Fix typescript-ts-mode indentation (bug#77803)
Don't align variable names to their declaratory expression. Before this commit in code like: const a = 1, b = 2; the b would get indented to `const'. Similarly for `var' and `let'. The expected behavior instead is getting indented to `typescript-ts-mode-indent-offset'. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--indent-rules): Indent identifiers declarations to `typescript-ts-mode-indent-offset'. * test/lisp/progmodes/typescript-ts-mode-resources/indent.erts (Lexical and variable declarations): Update test accordingly.
This commit is contained in:
parent
ef8bfe90b7
commit
9750333dde
2 changed files with 15 additions and 15 deletions
|
@ -130,7 +130,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
||||||
((parent-is "type_arguments") parent-bol typescript-ts-mode-indent-offset)
|
((parent-is "type_arguments") parent-bol typescript-ts-mode-indent-offset)
|
||||||
((parent-is "type_parameters") parent-bol typescript-ts-mode-indent-offset)
|
((parent-is "type_parameters") parent-bol typescript-ts-mode-indent-offset)
|
||||||
((parent-is ,(rx (or "variable" "lexical") "_" (or "declaration" "declarator")))
|
((parent-is ,(rx (or "variable" "lexical") "_" (or "declaration" "declarator")))
|
||||||
typescript-ts-mode--anchor-decl 1)
|
parent-bol typescript-ts-mode-indent-offset)
|
||||||
((parent-is "arguments") parent-bol typescript-ts-mode-indent-offset)
|
((parent-is "arguments") parent-bol typescript-ts-mode-indent-offset)
|
||||||
((parent-is "array") parent-bol typescript-ts-mode-indent-offset)
|
((parent-is "array") parent-bol typescript-ts-mode-indent-offset)
|
||||||
((parent-is "formal_parameters") parent-bol typescript-ts-mode-indent-offset)
|
((parent-is "formal_parameters") parent-bol typescript-ts-mode-indent-offset)
|
||||||
|
|
|
@ -67,22 +67,22 @@ Name: Lexical and variable declarations
|
||||||
=-=
|
=-=
|
||||||
const foo = () => {
|
const foo = () => {
|
||||||
let x = 1,
|
let x = 1,
|
||||||
yyyy: {
|
yyyy: {
|
||||||
[k: string | number]: string,
|
[k: string | number]: string,
|
||||||
} = {
|
} = {
|
||||||
"foo": "foo",
|
"foo": "foo",
|
||||||
"bar": "bar",
|
"bar": "bar",
|
||||||
};
|
};
|
||||||
var obar = 1,
|
var obar = 1,
|
||||||
fo: { [x: any]: any } = {
|
fo: { [x: any]: any } = {
|
||||||
"a": 1,
|
"a": 1,
|
||||||
"b": 2,
|
"b": 2,
|
||||||
};
|
};
|
||||||
const cccc = 1,
|
const cccc = 1,
|
||||||
bbb = {
|
bbb = {
|
||||||
"x": 0
|
"x": 0
|
||||||
},
|
},
|
||||||
ddddd = 0;
|
ddddd = 0;
|
||||||
// First decls with value starting on same line
|
// First decls with value starting on same line
|
||||||
const a = (x: string): string => {
|
const a = (x: string): string => {
|
||||||
return x + x;
|
return x + x;
|
||||||
|
|
Loading…
Add table
Reference in a new issue