Skip to content

Conversation

@CookedMelon
Copy link
Contributor

A description of this issue can be found at this link #4305


// Skip paste handling for single line copies from the same document to avoid unwanted escaping
// in string literals when copying lines
const isSingleLineCopy = !insertText.includes('\n') && !insertText.includes('\r');
Copy link
Collaborator

@fbricon fbricon Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to

const editorData = dataTransfer.get("vscode-editor-data")?.value;
const isSingleLineCopy = Boolean(editorData && JSON.parse(editorData).isFromEmptySelection);

Comment on lines 85 to 89
// Skip paste handling when pasting content that contains quotes to avoid unwanted escaping
// This is a broader check than the above to handle cases where content is modified or from different documents
if (insertText.includes('"')) {
return undefined; // Let VS Code handle this normally
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to remove this whole block, as it simply breaks the smart pasting feature

@CookedMelon
Copy link
Contributor Author

Thanks for the feedback, @fbricon. I have updated the logic and remove the redundant quote-checking block as suggested.

@fbricon fbricon merged commit 603e87c into redhat-developer:main Jan 13, 2026
2 checks passed
@fbricon
Copy link
Collaborator

fbricon commented Jan 13, 2026

thanks @CookedMelon

@fbricon fbricon changed the title Fix paste escaping issue when cursor is inside string literals Fix paste handling for single line copies Jan 13, 2026
@fbricon fbricon added this to the End January 2026 milestone Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants