Skip to content

Refactor changes if/else formatting #38017

Closed

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);
    }
}

Activity

  1. added
    Domain: LS: Refactorings
    on Apr 17, 2020
  2. added
    VS Code Priority
    on Apr 20, 2020
  3. added
    Fix Available
    on Jun 26, 2020
  4. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDomain: LS: RefactoringsFix AvailableVS Code Priority

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions