Skip to content

Autoindent on paste fails when first line of clipboard is a comment #201420

Closed

Description

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

  • VS Code Version: 1.85.1
  • OS Version: Darwin arm64 22.6.0

Steps to Reproduce:

  1. Ensure the Editor: Auto Indent setting is set to "full"
  2. Add the following to a .js file:
// comment
const foo = 42

function bar() {

    console.log("bar")
}
  1. Copy the the first two lines to the clipboard
  2. Put the cursor on the empty line inside the bar function
  3. Paste from the clipboard

Expected: The two pasted lines should be autoindented inside the function
Actual: The lines are not auto indented, they retain their original indent of 0

This only happens when the first line being pasted is a comment.

Activity

  1. added
    editor-autoindent
    under-discussion
    on Jan 2, 2024
  2. aiday-mar commented on Jun 11, 2025

    @aiday-mar
    Collaborator

    Should be fixed in the next stable release. You need to set "editor.autoIndentOnPaste": true, when the setting appears.

  3. locked and limited conversation to collaborators on Jul 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

editor-autoindentjavascriptunder-discussion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions