You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 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)
Activity
akaroml commentedon Oct 21, 2019
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.
testforstephen commentedon Oct 21, 2019
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.organizeImportstofalseakaroml commentedon Oct 22, 2019
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)
akaroml commentedon Oct 25, 2019
This is resolved with 0.52.0 release of vscode-java. redhat-developer/vscode-java#1115 redhat-developer/vscode-java#1116