Search code examples
indentationvisual-studio-code

VS code indentation when copying and pasting is messed up


Why is the indentation almost always messed up when copying and pasting code in VScode?

For example:

Copying:

Copy Example

Pasting:

Pasting example

Another example:

copy example

paste example

And it's sometimes even more messed up.

Is there a way to fix it?


Solution

  • I'm new to VSCode, but do you have "editor.formatOnPaste": true?