exk0730 exk0730 - 12 days ago 4
TypeScript Question

WebStorm, empty code blocks, and curly braces

Every time I "Reformat Code", WebStorm will place a new-line in between any empty curly braces. For example, if I have this code:

export class Example {}


and I reformat the code (
Command + Option + L
on mac), I end up with this:

export class Example {
}


How can I stop my editor from inserting a new line? WebStorm version is 2016.2

Answer

With these settings it seems to work -- IDE will not break such code into multiple lines but will leave as is.

  1. Settings/Preferences | Editor | Code Style | TypeScript --> Wrapping and Braces
  2. Keep when reformatting | Simple block in one line -- checked
  3. Braces placement | In class declaration -- "End of line"

enter image description here

Screenshot from PhpStorm 2016.3 ... but it should be the same in 2016.2.

Comments