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

[Bug] Refactor breaks some statements into 2 lines #38204

Open
AbdelrahmanHafez opened this issue Apr 27, 2020 · 0 comments
Open

[Bug] Refactor breaks some statements into 2 lines #38204

AbdelrahmanHafez opened this issue Apr 27, 2020 · 0 comments
Assignees
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol
Milestone

Comments

@AbdelrahmanHafez
Copy link

AbdelrahmanHafez commented Apr 27, 2020

re: #27294 (comment) microsoft/vscode#96172

Refactoring changes formatting in the sense that it removes empty lines, which is fixed by #36688 but another issue is that it breaks original code into 2 lines in some cases.

TypeScript Version: 3.9.0-dev.20200425

Search Terms: refactor, empty line, linebreak, formatting persistence.

Given the following piece of code, when I extract the condition and console.log into a function, console.log moves to a new line.

if (true) console.log('On the same line');

Expected behavior:

log();

function log () {
  if (true) console.log('On the same line');
}

Actual behavior:

log();

function log () {
  if (true)
    console.log('On the same line');
}

Related Issues: #27294 microsoft/vscode#96172

@jessetrinity jessetrinity added Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol labels Apr 29, 2020
@jessetrinity jessetrinity self-assigned this May 1, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Sep 11, 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
Projects
None yet
Development

No branches or pull requests

3 participants