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

"Move to a new file" refactoring removes all blank lines from JS code #66794

Closed
raiskila opened this issue Jan 20, 2019 · 1 comment
Closed
Assignees
Labels
editor-code-actions Editor inplace actions (Ctrl + .) editor-find Editor find operations javascript JavaScript support issues typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@raiskila
Copy link

Summary

For some reason, VS Code removes all blank lines from Javascript code when using the "Refactor..." –> "Move to a new file" feature.

Versions

  • VSCode Version: 1.31.0-insider (1.31.0-insider)
  • OS Version: macOS 10.14.2 (18C54)

Steps to Reproduce:

  1. Create an empty directory
  2. Open that directory in VS Code
  3. Create a new file called index.js within that directory with, say, the following contents:
const abc = () => {
  const a = 10;
  
  return a;
};

abc();
  1. Highlight the entirety of the abc function.
  2. Select "Refactor..." from the command palette.
  3. Select "Move to a new file"

Expected result:

Blank lines inside and between functions are preserved when moving the code to a new file.

Actual result:

Blank lines are stripped from the code when moving to a new file.

Does this issue occur when all extensions are disabled?

Yes, tried it with --disable-extensions and a brand new user data dir.

@vscodebot vscodebot bot added the editor-find Editor find operations label Jan 20, 2019
@mjbvz
Copy link
Collaborator

mjbvz commented Jan 21, 2019

Thanks for the report.

We are already tracking this issue upstream: microsoft/TypeScript#27294

@mjbvz mjbvz closed this as completed Jan 21, 2019
@mjbvz mjbvz added upstream Issue identified as 'upstream' component related (exists outside of VS Code) typescript Typescript support issues javascript JavaScript support issues editor-code-actions Editor inplace actions (Ctrl + .) labels Jan 21, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-code-actions Editor inplace actions (Ctrl + .) editor-find Editor find operations javascript JavaScript support issues typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

2 participants