Skip to content

pasteEdits returns no edit when there are no imports needed #59189

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

Merged
merged 7 commits into from
Jul 9, 2024

Conversation

navya9singh
Copy link
Member

This pr fixes #58934. It makes getPasteEdits not return any edits if there are no imports added as a fix. Instead, the normal vscode's pasting logic would kick in to only paste text without imports.

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Jul 8, 2024
@navya9singh navya9singh requested a review from andrewbranch July 8, 2024 22:15
@@ -71,6 +71,7 @@ function pasteEdits(
newText = actualPastedText ? newText.slice(0, pos) + actualPastedText[0] + newText.slice(end) : newText.slice(0, pos) + pastedText[i] + newText.slice(end);
}

let returnImportEdits = true;
Copy link
Member

Choose a reason for hiding this comment

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

Just move the importAdder declaration outside the runWithTemporaryFileUpdate callback and then you won't need a new variable

@navya9singh navya9singh merged commit ded36b2 into microsoft:main Jul 9, 2024
29 checks passed
@sandersn sandersn removed this from PR Backlog Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getPasteEdits returns edits even when no imports are added
3 participants