Skip to content

Copy-paste screws up indentation for no reason AND alters contents of pasted string #235348

@php4fan

Description

@php4fan

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.95.3
  • OS Version: Manjaro Linux

Steps to Reproduce:

  1. I start with this code:

Image

  1. Then I start adding this:

Image

  1. I copy this portion of code from above:

Image

  1. And I paste it here:

Image

Expected behavior:

I should get this:

Image

Observed behavior:

I get this instead:
Image

This is completely bonkers! Not only is this not sensible indentation, but crucially, the pasted code alters the contents of the string!!!!!!

Sometimes, when pasting a multi-line string into a region of code with different indentation than the one the original string was copied from, one doesn't get the desired indentation and that's expected because the contents of the string are sacred. The IDE doesn't know whether the whitespaces inside the string matter, so, at least by default, it preserves the contents of the string at the expense of indentation. And that's expected.

But here, the resulting indentation makes no sense AND the contents of the pasted string are altered with respect to the copied one!! This makes no sense whatsoever! The indentation of the code where the new code is pasted is the same as where the code is copied from, so there's no need to alter the indentation in the first place, but the IDE is removing spaces for no reason whatsoever AND it's changing the contents of a pasted string, even unnecessarily.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugeditor-autoindentEditor auto indentation issuesinsiders-releasedPatch has been released in VS Code InsidersverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions