Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Refactor changes if/else formatting #38017

Copy link
Copy link
@mjbvz

Description

@mjbvz
Issue body actions

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);
    }
}
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

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

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.