-1

Is there are way to prevent VSC from formatting short objects?

After I formatted my code:

let obj = {
  a: 1,
  b: 2
}

What I prefer:

let obj = {a: 1, b: 2}
Gama11
  • 31,714
  • 9
  • 78
  • 100
bonblow
  • 1,151
  • 6
  • 19
  • 28

1 Answers1

0

I would recommend to disable VSC builtin formatting function and use js-beautify as it has an option not to break short-objects that fits into a single line.

Read more about beutify-js here The feature I'm referring to is here

helcode
  • 1,859
  • 1
  • 13
  • 32
  • Thank you. How can I disable VSC builtin formatting function? – bonblow Mar 11 '18 at 17:22
  • Go to VSC preferences, search for format and make sure built-in format settings is set for FALSE. – helcode Mar 11 '18 at 20:10
  • Check this thread on how to disable formating https://stackoverflow.com/questions/737222/turn-off-auto-formatting-in-visual-studio – helcode Mar 11 '18 at 20:11