Skip to content

'Disable JS Checks for This File' Quick Fix Inserts Extra NewLine  #15398

Closed
@mjbvz

Description

@mjbvz

From: microsoft/vscode#25405

TypeScript Version: 2.3.1-insider0425

Code

// @ts-check
const e = new Error();
e.x = 3;
  1. on e.x select the Disable checks in this file quick fix

Expected behavior:
Code becomes:

// @ts-nocheck
const e = new Error();
e.x = 3;

Actual behavior:
An extra new line is added:

// @ts-nocheck
const e = new Error();
e.x = 3;

It seems an extra \n is returned in the quick fix insert text

    {
        "description": "Disable checking for this file.",
        "changes": [
            {
                "fileName": "untitled:Untitled-1",
                "textChanges": [
                    {
                        "start": {
                            "line": 1,
                            "offset": 1
                        },
                        "end": {
                            "line": 1,
                            "offset": 13
                        },
                        "newText": "// @ts-nocheck\n"
                    }
                ]
            }
        ]
    }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Quick FixesEditor-provided fixes, often called code actions.VS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions