Skip to content

Overlapping formatting edits returned for jsx #30898

Description

@mjbvz

TypeScript Version: 3.5.0-dev.20190412

Search Terms:

Code
Run format on the following js (note that the whitespace is significant):

const a = (
    <div
>x
        
    </div>
)

Bug
The returned response contains overlapping edits:

[Trace  - 2:02:46 PM] Response received: format (16). Request took 3 ms. Success: true 
Result: [
    {
        "start": {
            "line": 3,
            "offset": 1
        },
        "end": {
            "line": 3,
            "offset": 1
        },
        "newText": "    "
    },
    {
        "start": {
            "line": 4,
            "offset": 1
        },
        "end": {
            "line": 4,
            "offset": 8
        },
        "newText": "               "
    },
    {
        "start": {
            "line": 4,
            "offset": 1
        },
        "end": {
            "line": 4,
            "offset": 9
        },
        "newText": ""
    }
]

Playground Link:

Related Issues:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions