Skip to content

Destructuring does not auto-format whitespace #12239

Description

@waderyan

From @marcomorain on November 4, 2016 15:39

  • VSCode Version: 1.7.1 02611b40b24c9df2726ad8b33f5ef5f67ac30b44 2016-11-03T13:44:00.572Z
  • OS Version: OSX 10.12.1 (16B2657)

Issue

The whitespace on the LHS of a destructuring assignment is not formatted.

Steps to Reproduce:

  1. Add the following to a typescript file:
const {NoSpaces} = { NoSpaces: 1 }
const { WithSpaces } = { WithSpaces: 1 }
const {OneSpace } = { OneSpace: 1 };
  1. Format the document.

Expected

I would expect the whitespace on the LHS of the assignment to be consistent. I would expect either:

const {NoSpaces} = { NoSpaces: 1 }
const {WithSpaces} = { WithSpaces: 1 }
const {OneSpace} = { OneSpace: 1 };

or

const { NoSpaces } = { NoSpaces: 1 }
const { WithSpaces } = { WithSpaces: 1 }
const { OneSpace } = { OneSpace: 1 };

Actual Output

Whitespace of the LHS is inconsistent:

const {NoSpaces} = { NoSpaces: 1 }
const { WithSpaces } = { WithSpaces: 1 }
const {OneSpace } = { OneSpace: 1 };

Copied from original issue: microsoft/vscode#14996

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: FormatterThe issue relates to the built-in formatterFixedA PR has been merged for this issueVS Code TrackedThere is a VS Code equivalent to this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions