Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell auto-format in VS Code not to insert spaces after opening and before closing curly braces?

Whenever I use the auto-format shortcut (Shift + Alt + k) in Visual Studio Code inside a file that contains this piece of code -

var keyframes = [
  {opacity: 0, transform: 'translate(0, 4em)'},
  {opacity: 1, transform: 'translate(0)'}
];

I get this -

var keyframes = [
  { opacity: 0, transform: 'translate(0, 4em)' },
  { opacity: 1, transform: 'translate(0)' }
];

I wonder if there's any way to tell the auto-format not to insert all the spaces?

like image 701
Justin XL Avatar asked Feb 22 '16 23:02

Justin XL


People also ask

How do I stop Visual Studio from auto spacing?

Save without Formatting Selecting it in the command palette: CTRL + SHIFT + P. Doing the keyboard shortcut: CTRL + K , S.

Why is VS Code adding spaces?

When saving, Visual Studio inserted a lot of spaces. This happened after an update of Visual Studio. This problem was because of an extension called Bracket Pair Colorizer .

How do I fix the format in VS Code?

The code formatting is available in Visual Studio Code through the following shortcuts: On Windows Shift + Alt + F. On Mac Shift + Option + F. On Linux Ctrl + Shift + I.


Video Answer


1 Answers

Sorry, but the formatting options are currently not exposed to the user. It is high on our backlog.

like image 158
Erich Gamma Avatar answered Sep 28 '22 18:09

Erich Gamma