You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When extracting a code block into a function in global scope, the code formatting often changes in the sense that all empty lines are removed, and some parts go into new lines in themselves.
I would expect the formatting to stay the same.
VSCode Version: 1.44.2 (system setup)
OS Version: Windows_NT x64 10.0.18363
Steps to Reproduce:
Let's look at this code for example:
constmongoose=require('mongoose');const{ Schema }=mongoose;constassert=require('assert');run().catch(console.error);asyncfunctionrun(){// Beginning of code block I want to refactorawaitmongoose.connect('mongodb://localhost:27017/test',{useNewUrlParser: true,useUnifiedTopology: true});awaitmongoose.connection.dropDatabase();if(true)console.log('on the same line with condition');// End of code block I want to refactorconstuserSchema=newSchema({name: {type: String}});constUser=mongoose.model('User',userSchema);assert.ok(User.findOne);console.log('Done.');}
When I separate the code between the two comments into a function in the global scope, all the empty lines are removed, and the console.log(...) is moved to the next line after the condition.
constmongoose=require('mongoose');const{ Schema }=mongoose;constassert=require('assert');run().catch(console.error);asyncfunctionrun(){awaitprepareConnection();constuserSchema=newSchema({name: {type: String}});constUser=mongoose.model('User',userSchema);assert.ok(User.findOne);console.log('Done.');}asyncfunctionprepareConnection(){awaitmongoose.connect('mongodb://localhost:27017/test',{useNewUrlParser: true,useUnifiedTopology: true});awaitmongoose.connection.dropDatabase();// empty line above and below are deletedif(true)console.log('on the same line with condition');// should move to the line above}
Does this issue occur when all extensions are disabled?: Yes
The text was updated successfully, but these errors were encountered:
We won't include TypeScript 3.9 with this fix until VS Code 1.46. Until then, try upgrading your workspace to use typescript@next by installing this extension
When extracting a code block into a function in global scope, the code formatting often changes in the sense that all empty lines are removed, and some parts go into new lines in themselves.
I would expect the formatting to stay the same.
Steps to Reproduce:
Let's look at this code for example:
When I separate the code between the two comments into a function in the global scope, all the empty lines are removed, and the
console.log(...)
is moved to the next line after the condition.Does this issue occur when all extensions are disabled?: Yes
The text was updated successfully, but these errors were encountered: