Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incorrect indent in vs code when I paste codes?

Here are my original html codes:

<div class="container">
</div>
<div class="box box-1"></div>
<div class="box box-2"></div>
<div class="box box-3"></div>

and I just want to move the three div.box to div.container, but when I paste directly, it will be like this, just the fist line has correct indent:

<div class="container">
  <div class="box box-1"></div>
<div class="box box-2"></div>
<div class="box box-3"></div>
</div>

I followed the instruction to disable the aotoIndent in the settings, but didn't work, so how to handle it?

like image 252
Revenant Avatar asked Apr 16 '18 03:04

Revenant


2 Answers

If you cannot set the editor.formatOnPaste to true. Then use the following key combination to manually format/ indent Alt+Shift+F

like image 162
AbhishekGowda28 Avatar answered Sep 21 '22 12:09

AbhishekGowda28


I know you said this didnt worked for you, but it did work for me and it may help others i think it worth mentioning: This worked for me: Go to VS Code Settings -> from the User Settings tab -> Text Editor -> Formatting -> Untick the first option 'Format On Paste'

like image 29
Ridha Rezzag Avatar answered Sep 21 '22 12:09

Ridha Rezzag