Revenant
Revenant

Reputation: 327

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?

Upvotes: 10

Views: 5812

Answers (3)

Emory Hubbard
Emory Hubbard

Reputation: 11

Since your settings aren't working as desired, one good way to handle this behavior is to highlight the text and press tab. This will increase indentation on all lines. You can repeat to get to your desired indentation level.

Upvotes: 0

Rida Rezzag
Rida Rezzag

Reputation: 3963

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'

Upvotes: 2

AbhishekGowda28
AbhishekGowda28

Reputation: 1054

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

Upvotes: 9

Related Questions