Skip to content

Wrong formatting inside JavaScript object by hitting "." #4277

Open
@Chris2011

Description

@Chris2011

Apache NetBeans version

Apache NetBeans 14

What happened

When you have this piece of code:

const test = {

};

and you hit enter after the open bracket, it will auto indent n-spaces depends on the defaults/settings. For me it is 4 spaces. When you now hit ".", the formatting jumps 8 spaces further which is not correct.

const test = {
            .
};

js-misformatting

How to reproduce

  • Open/Create a new JS file inside an HTML5 Project
  • Type the example code in
  • Go to the new line between the brackets and hit "."
  • It will add more spaces than expected. Doesn't matter whether the cursor is on position 0 or on the indentation (please see my little screencast)

Did this work correctly in an earlier version?

No

Operating System

Windows 11

JDK

OpenJDK Runtime Environment 14+36-1461

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

I also set the JavaScript features to "ESNext" that also didn't work out.

Are you willing to submit a pull request?

No

Code of Conduct

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    JavaScript[ci] enable web job and extra JavaScript tests (webcommon/javascript2.editor)kind:bugBug report or fixneeds:triageRequires attention from one of the committers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions