Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor changes if/else formatting #38017

Closed
mjbvz opened this issue Apr 17, 2020 · 0 comments · Fixed by #39280
Closed

Refactor changes if/else formatting #38017

mjbvz opened this issue Apr 17, 2020 · 0 comments · Fixed by #39280
Assignees
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol Fix Available A PR has been opened for this issue VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Apr 17, 2020

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);
    }
}
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Apr 17, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Apr 17, 2020
@RyanCavanaugh RyanCavanaugh added the Domain: Refactorings e.g. extract to constant or function, rename symbol label Apr 17, 2020
@mjbvz mjbvz added the VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone label Apr 20, 2020
@RyanCavanaugh RyanCavanaugh modified the milestones: Backlog, TypeScript 4.0 Apr 22, 2020
@andrewbranch andrewbranch added the Fix Available A PR has been opened for this issue label Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol Fix Available A PR has been opened for this issue VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants