Skip to content

Refactor changes if/else formatting #38017

Closed
@mjbvz

Description

@mjbvz

TypeScript Version: 3.9.0-dev.20200416

Search Terms:

  • refactor / refactoring
  • format

Code
For the code:

function foo() {
    if (true) {
        console.log(1);
    } else {
        console.log(1);
    }
}
  1. Select the body of the function and run extract to function

Bug:
In the new function, a new line is added before the else:

function foo() {
    newFunction();
}

function newFunction() {
    if (true) {
        console.log(1);
    }
    else {
        console.log(1);
    }
}

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Refactoringse.g. extract to constant or function, rename symbolFix AvailableA PR has been opened for this issueVS Code PriorityCritical issues that VS Code needs fixed in the current TypeScript milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions