Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Javascript Code Format Indentation not always correct #8641

Copy link
Copy link
@dbaeumer

Description

@dbaeumer
Issue body actions

From @zevero on May 13, 2016 8:28

  • VSCode Version: 1.1.0
  • OS Version: Debian Stretch

There is a glitch of the (otherwise very perfect) Javascript Code Format:

Steps to Reproduce:
0. (Set "editor.tabSize": 2 for using 2 spaces as indentation)

  1. save this as a .js file
    var series = [{
      name: 'One',
      data: []
    }, {
        name: 'Two',
        data: []
      }, {
        name: 'Three',
        data: []
      }
    ];
  1. Press Ctrl+Shift+i to format code
  2. The Object named One will not get indented correctly.
  3. Indent it manually, so it is aligned with Two and Three.
  4. Press Ctrl+Shift+i
  5. Object One is misaligned again.

It does not understand how to format an object in this way (used in highcharts for example)
It works however if the first '{' is written in an extra line (which I do not like).

I may sound picky, but this is the first code formatter, that I actually use extensively and so I really care! It formats nicely without interfering too much!
Thank you!

Copied from original issue: microsoft/vscode#6336

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issueA PR has been merged for 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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.