Paste Indentation FixKeeps the existing line after pasted code at its original indentation, in any language. VS Code still indents the pasted code normally. Use Cmd+V on macOS, Ctrl+V on Windows/Linux, or Paste without Moving the Following Line from the Command Palette. The workaround preserves an existing following line when the paste leaves that line intact. This includes whole-line copies made with nothing selected and selections ending at the start of a line. It addresses VS Code's auto-indent-on-paste behavior when these settings are enabled:
The underlying VS Code bug is language-independent and has been reported in Ruby and PHP. For example, paste two items before a Ruby array's closing bracket. VS Code can move the existing bracket:
Paste Indentation Fix preserves its original indentation:
The correction adds one undo step. Native menu Paste bypasses the workaround. Line remainders changed by the paste and multiple cursors retain VS Code's normal behavior. Requires VS Code 1.141.0 or newer. Tested on macOS with the reported Ruby and PHP examples, whole-line copies and replacements, partial selections, mid-line paste, overtype, tabs, CRLF, multiple cursors, cursor placement, and repeated undo/redo. Related VS Code reports: #143573 (Ruby) and #221574 (PHP). Proposed upstream fix: PR #329281. Previously named Ruby Paste Fix. Version 0.2.0 removes the Ruby-only restriction; the Marketplace identifier remains |