Skip to content

Refactor removes whitespace #27294

Closed
@markusjohnsson

Description

@markusjohnsson

Refactors, like 'move to a new file', butchers formatting by removing empty lines in code. As refactors are meant to improve code style and structure, I should not manually have to reformat my code after I've applied one.

TypeScript Version: 3.1.0-dev.20180922

Search Terms:
Move to new file removes newlines, refactor removes newlines, removes whitespace, removes trivia

Code

function example() {
    thisIsAnExampleWithSomeSpace();

    anotherCallToSomeFunctionHere();

    evenMoreStatementsLater();
}

Select function and 'move to a new file' in VS Code:
Expected behavior:
Same formatting:

export function example() {
    thisIsAnExampleWithSomeSpace();

    anotherCallToSomeFunctionHere();

    evenMoreStatementsLater();
}

Actual behavior:
Blank lines removed:

export function example() {
    thisIsAnExampleWithSomeSpace();
    anotherCallToSomeFunctionHere();
    evenMoreStatementsLater();
}

Related Issues:
Perhaps related to #843

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix 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