Skip to content

Bug: Pasting doesn't remove selection #247

Closed

Description

Environment:

  • VS Code Version: 1.39.2
  • Extension Version: 0.8.0
  • JDK Type & Version: Java 9+181
  • OS Type & Version: Windows_NT x64 10.0.15063

Step to Reproduce:

  1. Highlight text (click and drag)
  2. Copy text (Ctrl + C)
  3. Paste text (Ctrl + V)

Expected Behavior:
Text selection has not changed

Actual Behavior:
Paste overwrites the selected (identical) text. Text becomes unselected. Cursor moves to the end of the pasted section

Related Issues:
N/A

I have a common pattern where I like to duplicate a couple of lines. To do this I highlight the text, copy, paste and paste again. Now, pasting does not remove the text selection, so the second paste overwrites the first paste, leaving me exactly where I started.

Activity

  1. akaroml commented on Oct 21, 2019

    @akaroml
    Member

    Thanks for reporting. Michael Standen (@ScreamingHawk)

    I can reproduce this and it seems this issue is only with Java code. Jinbo Wang (@testforstephen) please see whether the LS is doing something wrong.

  2. testforstephen commented on Oct 21, 2019

    @testforstephen
    Contributor

    This is a recent feature "organize imports on paste" introduced by Java LS. When you paste a java code into current editor, the java LS will trigger organize import operation to add the missing import, that's why previous focus is lost. You can disable it via user setting java.actionsOnPaste.organizeImports to false

  3. akaroml commented on Oct 22, 2019

    @akaroml
    Member

    This is a recent feature "organize imports on paste" introduced by Java LS. When you paste a java code into current editor, the java LS will trigger organize import operation to add the missing import, that's why previous focus is lost. You can disable it via user setting java.actionsOnPaste.organizeImports to false

    This behavior is a bit strange. It actually stops people from copying and pasting whatever is currently selected. It's like interfering with the fundamental editing features. Please investigate how we can organize imports on paste while allowing users to actually paste.

    On the other hand, VS Code actually have the alternative of copying the selection in place. Check the Selection > Copy Line Up/Down menu items. Michael Standen (@ScreamingHawk)

  4. akaroml commented on Oct 25, 2019

    @akaroml
    Member

    This is resolved with 0.52.0 release of vscode-java. redhat-developer/vscode-java#1115 redhat-developer/vscode-java#1116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions