Skip to content

Object literal on new line is indented inconsistently  #32923

Closed
@minestarks

Description

@minestarks

TypeScript Version: 3.5.2

Search Terms: object literal indent formatting

Code

var x = 
{

}

x = 
{
    
}

Format whole document.

Expected behavior:

  • No formatting changes. This is the indentation that smart indent produces as you type so in theory format document shouldn't change anything.
  • The two object literals should get the same treatment.

Actual behavior: Document reformatted to:

var x =
{

}

x =
    {

    }

Playground Link: http://www.typescriptlang.org/play/#code/G4QwTgBAHhC8ECgDeCEF9U3shE+LSA

Related Issues: #22849 seems to have fixed this for the variable declaration but not the assignment case. They should be the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: FormatterThe issue relates to the built-in formatter

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions