1

I want to use vscode to format my js code. But I just want it to format indent, not any other space in my statement.

But I have not found any way to control this config.

e.g.: If I have some code like this(where the colons is aligned but no indent):

let o = {
a                   : 1,
the_long_item_here  : 2,
};

I want vscode to format the indent like this(just add indent but colons still aligned):

let o = {
    a                   : 1,
    the_long_item_here  : 2,
};

But actually vscode give me the result:

let o = {
    a: 1,
    the_long_item_here: 2,
};

where the indent is done well, but the colons alignment is lost.

How can I fix this?

1 Answers1

0

Try saving you project file as a .js or desired file extension. Visual studio code will automatically apply indentation and other formatting based on the criteria for the file extension type.