angular @Component formatting editorconfig wrong alignment

已回答

I want to use Intellij with angular.
Each component is decorated like:
@Component({
  selector: 'app-three-stage-table-example-page',
  templateUrl: './three-stage-table-example-page.component.html',
  styleUrls: ['./three-stage-table-example-page.component.scss'],
})
But Intellij formats it like this. It somehow tries to align the whole object with its attributes based on the first curly brace.

@Component({
             selector: 'app-three-stage-table-example-page',
             templateUrl: './three-stage-table-example-page.component.html',
             styleUrls: ['./three-stage-table-example-page.component.scss'],
           })

I can't find an editorconfig option to make it work with the normal indent and turn off this alignement. Can anyone help?

In the rest of the code I can declare objects normally without this alignement issue, so
const test = {
  a: 1, b: 'test',
  c: 'another',
};
works just fine.

0

I think I found a fix.
ij_typescript_align_multiline_parameters_in_calls = false
prevents this behavior

1

Lorenz Baier 
Thank you for sharing the solution!

0

请先登录再写评论。