Search code examples
typescriptvisual-studio-codeindentationlint

Is there a way to configure closing indentation in multiline function call?


In visual studio code, when editing a typescript file, if I want to reindent this piece of code with the reindent command :

this.someClass.method(
    argumentA,
    argumentB,
);

it would change it to :

this.someClass.method(
    argumentA,
    argumentB,
    ); // <-- messed up indentation

And the rest of the file will have shifted indentation from there.

Is there a way to fix this behavior, i.e. to tell the editor to put the closing parenthesis at the same indentation level as the beginning of the call statement ?


Solution

  • I believe that the Format Document command is the recommended way to prettify a file in VSCode.

    Also, I highly recommend Prettier to do this on ave automatically. Once you get used to it, it's so nice.