Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pasting into code line below a jsdoc block comment auto-indents by one space character #119225

Closed
danielrentz opened this issue Mar 18, 2021 · 7 comments · Fixed by #136579
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug editor-autoindent Editor auto indentation issues insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Milestone

Comments

@danielrentz
Copy link

  • VS Code Version: 1.54.3
  • OS Version: Win 10

Steps to Reproduce:

  1. Have the following code snippet in a JS editor
/**
 * doc
 */
x = 1;
  1. copy a word to clipboard, e.g. "var"
  2. place cursor before "x", paste

Result: The pasted word indents the line by one space. This should not happen below such a jsdoc comment block.

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

@DavidSvetlik
Copy link

Yes, please fix it, it's really annoying and wasn't happening couple of versions back.

@danielrentz
Copy link
Author

danielrentz commented Apr 7, 2021

Alternative steps to reproduce, most likely the same root cause:

Copy the following block, paste it into an empty line. Everything following the first jsdoc comment will be indented.

/**
 * doc
 */
var x = 1;

/**
 * doc
 */
var y = 1;

@adamreisnz
Copy link

I can also confirm this is happening consistently in Javascript, and that this didn't use to happen in earlier versions.
Note that Format on Paste is disabled, and no extensions have been enabled.

Example 1

/**
 * Block comment
 */
class Test {

  /**
   * Block comment
   */
  someMethod() {
    doSomething()
  }
}

To reproduce:
Select and copy the whole block of code (including block comment) of someMethod as follows:
image

Paste the block 2 rows below and observe that there is an extra space added before someMethod:

image

Example 2

Same code as below, but this time paste the block outside of the class. The whole comment block gets wrecked, and the extra space is still there:

image

There are more examples with subtly different behaviour, but these are the most aggravating and I don't remember the others at this moment. I will update this comment and post again once I encounter them again.

Fun fact, I switched from Atom to VSCode precisely because it was riddled with these minor annoyances which would never get fixed and are still an issue 5 years later. I was so excited that VSCode didn't have any of the annoying paste bugs that Atom had, but now they have appeared here as well, and don't seem to be getting a lot of traction to fix 😢

@rebornix rebornix added bug Issue identified by VS Code Team member as probable bug editor-autoindent Editor auto indentation issues labels Oct 15, 2021
@ssigwart
Copy link
Contributor

ssigwart commented Nov 7, 2021

I found a better solution that I had in #128812. It's in #136579. I just need to get someone to review and merge it.

@gene-pavlovsky
Copy link

Hope this can be reviewed/merged

@dandeancook
Copy link

Merged the fix yet? i still see the extra space after pasting, i guess it is so due to autoformat after pasting

@VSCodeTriageBot VSCodeTriageBot added the unreleased Patch has not yet been released in VS Code Insiders label Nov 18, 2022
@VSCodeTriageBot VSCodeTriageBot added this to the November 2022 milestone Nov 18, 2022
@VSCodeTriageBot VSCodeTriageBot added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Nov 21, 2022
@rzhao271 rzhao271 added the verified Verification succeeded label Nov 30, 2022
@seebz
Copy link

seebz commented Dec 9, 2022

This issue also applies to other languages, at least PHP.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug editor-autoindent Editor auto indentation issues insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Projects
None yet
10 participants