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
Using this extension causes issues with the copy function in VS Code.
Step to Reproduce:
Create a file like test.java, the content is:
class test {
private String function () {
String a = "555\n555";
a = "ggg";
return a;
}
}
Scenario A (Selection Paste): Use the mouse to select the \n characters (inside the double quotes), copy them, and attempt to paste them.
Scenario B (Line Copy/Paste): Place the cursor anywhere inside the double quotes (on the line String a = "\n";) without selecting any text. Use the VS Code shortcut Ctrl + C then Ctrl + V (intended to duplicate the entire line).
The paste logic mostly does what it's supposed to do: escape the content before pasting it into a Java String (see #1249). So it will literally escape all new lines from the clipboard to insert into a compilable java String.
What you're expecting is raw pasting, you can choose by either Ctrl+Shift+P, or selecting "Insert Plain Text"
you can also disable Java smart pasting entirely with this setting:
"[java]": {
"editor.pasteAs.enabled": false
}
Now admittedly, at least one thing is not working as expected:
cursor anywhere on the a = "ggg"; line, then Ctrl+C then Ctrl+Shift+P (Insert plain text) inside the quotes doesn't just duplicate the line, but pastes the whole content into the existing line.
@CookedMelon the proposed changes in #4306 should fix the duplicate line problem.
Smart pasting could be improved so that pasting \n inside "555\n555" can turn into "555\n\\n555" (as in Eclipse), instead of aggressively adding a new line
Activity
fbricon commentedon Jan 13, 2026
The paste logic mostly does what it's supposed to do: escape the content before pasting it into a Java String (see #1249). So it will literally escape all new lines from the clipboard to insert into a compilable java String.
What you're expecting is raw pasting, you can choose by either Ctrl+Shift+P, or selecting "Insert Plain Text"
you can also disable Java smart pasting entirely with this setting:
Now admittedly, at least one thing is not working as expected:
a = "ggg";line, then Ctrl+C then Ctrl+Shift+P (Insert plain text) inside the quotes doesn't just duplicate the line, but pastes the whole content into the existing line.fbricon commentedon Jan 13, 2026
@CookedMelon the proposed changes in #4306 should fix the duplicate line problem.
Smart pasting could be improved so that pasting
\ninside"555\n555"can turn into"555\n\\n555"(as in Eclipse), instead of aggressively adding a new lineBut that needs to happen in https://github.com/eclipse-jdtls/eclipse.jdt.ls/blob/main/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/PasteEventHandler.java#L279