Skip to content
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

fix paste edits range: include all completely selected identifiers #60339

Merged
merged 5 commits into from
Oct 29, 2024

Conversation

iisaduan
Copy link
Member

@iisaduan iisaduan commented Oct 24, 2024

Fixes #60246

When checking usage info for paste edits, adjust the range to be node-based instead of purely position based, so identifiers at the edges of the copied range can be correctly resolved. Because of how whitespace/trivia is included in nodes, before, if trivia wasn't completely copied, some identifiers were skipped when checking for usage.

Only the first commit is the bug fix, the rest are tests and a small refactor in pasteEdits.

Comment on lines 180 to 181
// This function adjusts the range so that identifiers at the edges of the copied text are correctly included for imports.
// We do not need to adjust range when the tokens at the edges are not identifiers.
Copy link
Member

Choose a reason for hiding this comment

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

This should be jsdoc. At least, it seems like the comments are intended for callers of the function.

@iisaduan iisaduan merged commit 2161893 into microsoft:main Oct 29, 2024
32 checks passed
@iisaduan iisaduan deleted the pasteEdits-range branch October 29, 2024 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

No paste edits returned
4 participants