镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
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);
    }
}

Metadata

Metadata

Labels

BugA bug in TypeScriptDomain: LS: 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