Skip to content

[5.3][IDE][SourceKit] Support escaped identifiers for the syntactic rename and related idents requests. #31598

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 1 commit into from
May 6, 2020

Conversation

nathawes
Copy link
Contributor

@nathawes nathawes commented May 6, 2020

Cherry-pick of #31431

  • Explanation:
    Sourcekitd's SyntacticRename and RelatedIdents requests would previously not account for the extra two backtick characters in escaped identifiers, e.g. giving a range covering [`fo]o` rather than [`foo`].

    This updates their ranges to include the backticks, and for syntactic rename, to account for them when comparing base names and argument labels with expected values. It also updates Swift -> ObjC name translation (used for cross-language rename) to account for them too.

  • Scope of issue: The rename refactoring would fail if any occurrence of the symbol being renamed was escaped. The RelatedIdents request returning the incorrect ranges caused editor features based on it (like Xcode's edit-all-in-scope) to behave incorrectly.

  • Origination: This has been an issue since the SyntacticRename and RelatedIdents requests were fist introduced.

  • Risk: Low. This only affects the rename refactoring, and RelatedIdents requests. It has no impact on the compiler.

  • Testing: Added regression tests covering escaped identifiers and all existing tests passed. Also checked Xcode behaves correctly with these changes when renaming in cross-language projects.

  • Reviewer: Ben Langmuir (@benlangmuir) on the master branch PR.

Resolves rdar://problem/46409010

… and related idents requests.

Resolves rdar://problem/46409010
Resolves rdar://problem/48256383
@nathawes nathawes added the r5.3 label May 6, 2020
@nathawes nathawes requested a review from a team as a code owner May 6, 2020 20:51
@nathawes
Copy link
Contributor Author

nathawes commented May 6, 2020

@swift-ci please test

@nathawes nathawes requested a review from akyrtzi May 6, 2020 20:52
@nathawes
Copy link
Contributor Author

nathawes commented May 6, 2020

@swift-ci please nominate

@nathawes nathawes merged commit 30a7e5c into swiftlang:release/5.3 May 6, 2020
@nathawes nathawes deleted the rename-with-backticks-5.3 branch May 6, 2020 23:55
@AnthonyLatsis AnthonyLatsis added swift 5.3 🍒 release cherry pick Flag: Release branch cherry picks labels Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants