Skip to content

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
@sandersn sandersn removed this from PR Backlog Apr 22, 2025
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No paste edits returned

4 participants