Consider what I'd call some "ideal" smart indentation for the following code samples:
typeFoo=|"hello"|"world";{|"indentation": 0 |}letx=10,y=2;{|"indentation": 0 |}letx=10,y=2,{|"indentation": 4 |}letobj={x: "hello"+"world",{|"indentation": 4 |}
}classC{x="hello"+"world";
{| "indentation": 4 |}
}I've specified the "expected" indentation in each of these cases; however, TypeScript today keeps indentation are the same level as the prior line which is wrong. This is especially annoying for the multi-line union case.
There is some ambiguity when one uses an ASI-assuming style though. In these cases, I would personally err on the side of expecting the start indentation.
type Foo =
| "hello"
| "world"
{| "indentation": 0 |}
```ts
let x = 10,
y = 2
{| "indentation": 0 |}
classC{x="hello"+"world"
{| "indentation": 4 |}
}Then, even for cases where ASI doesn't really apply:
letobj={x: "hello"+"world"{|"indentation": 4 |}
}I would say we should pick the start element's base (where x starts), since we'll start doing #52899 eventually.
Consider what I'd call some "ideal" smart indentation for the following code samples:
I've specified the "expected" indentation in each of these cases; however, TypeScript today keeps indentation are the same level as the prior line which is wrong. This is especially annoying for the multi-line union case.
There is some ambiguity when one uses an ASI-assuming style though. In these cases, I would personally err on the side of expecting the start indentation.
type Foo =
| "hello"
| "world"
{| "indentation": 0 |}
Then, even for cases where ASI doesn't really apply:
I would say we should pick the start element's base (where
xstarts), since we'll start doing #52899 eventually.