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 duplicate locations in rename edits. #526

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

toinehartman
Copy link
Contributor

@toinehartman toinehartman commented Nov 19, 2024

In some cases, names of definitions also appear as use locations in the TModel. In those cases, the rename logic would mark that location as both a definition and use.
Since the addition of annotated edits, locations are not deduplicated, so VS Code would receive multiple edits for the same location, and fail to apply all of them. Many renames would fail due to this, depending on what kind of name the cursor was on.

This PR fixes this behaviour; it postpones attaching annotations to most rename locations, simplifying location deduplication (and, as a side-effect, de-duplicates the annotations as well). It also adds assertions against duplicate edit locations to the test framework.

@toinehartman toinehartman added the enhancement New feature or request label Nov 19, 2024
@toinehartman toinehartman self-assigned this Nov 19, 2024
Copy link
Member

@DavyLandman DavyLandman left a comment

Choose a reason for hiding this comment

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

LGTM, 2 small comments.

@toinehartman toinehartman force-pushed the fix/rename-refactoring/fail-to-apply-edits branch from 9b58d86 to ba2df53 Compare November 19, 2024 15:20
@toinehartman toinehartman merged commit 41d6fd6 into main Nov 19, 2024
12 of 13 checks passed
@toinehartman toinehartman deleted the fix/rename-refactoring/fail-to-apply-edits branch November 19, 2024 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants