Skip to content

Auto-indentation problem with promise blocks #10335

Open
@dbaeumer

Description

@dbaeumer

From @lumaxis on August 12, 2016 0:7

  • VSCode Version: 1.5.0-insider (666ed83)
  • OS Version: 10.11.6

Steps to Reproduce:

  1. Create a Typescript file and start writing code using promises
  2. Auto-indent file using Shift+Alt+D Shift+Alt-F

Expected Result:

return output
.then((result: ControllerResponse) => {
  return res
  .status(result.statusCode)
  .json(result.payload);
})

Actual Result:

return output
  .then((result: ControllerResponse) => {
    return res
    .status(result.statusCode)
    .json(result.payload);
  })

Description:

The problem with the current way is that it leads to a strange indentation on the closing braces:

    });
}

Here, the closing curly braces and parentheses for the .then() block are indented 4 spaces instead of 2 spaces as they should be.

Copied from original issue: microsoft/vscode#10453

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: FormatterThe issue relates to the built-in formatterHelp WantedYou can do thisVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions