Skip to content

[SourceKit] Refactor collection of available refactorings #64663

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
Mar 29, 2023

Conversation

bnbarham
Copy link
Contributor

Update to have a single refactoring collection method for cursor refactorings and another for ranges. The various functions were only needed because of the extra availability information on renames, so just give that to all refactorings.

@bnbarham bnbarham requested a review from hamishknight March 28, 2023 01:38
}
llvm::for_each(collectAvailableRefactoringsOtherThanRename(Info),
AddAction);
addRefactorings(Data.AvailableActions, collectRefactorings(Info, /*ExcludeRename=*/false));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This came about because I added a check in to not retrieve refactorings when within a generated buffer. But one of these call paths skipped that check because it was using a different collect function. I've considered merging these before, so just went ahead and did it now.

There's now collectRefactorings in Refactoring.cpp and then an addRefactorings within SwiftSourceDocInfo.cpp which converts it to the LangSupport struct.

@bnbarham bnbarham force-pushed the refactor-refactoring-collection branch from 8f6b7b8 to 737fbc5 Compare March 28, 2023 01:43
@bnbarham
Copy link
Contributor Author

@swift-ci please test

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me

Update to have a single refactoring collection method for cursor
refactorings and another for ranges. The various functions were only
needed because of the extra availability information on renames, so just
give that to all refactorings.
@bnbarham bnbarham force-pushed the refactor-refactoring-collection branch from 737fbc5 to a1c8280 Compare March 28, 2023 20:06
@bnbarham
Copy link
Contributor Author

@swift-ci please test

@bnbarham bnbarham merged commit 1c97cd0 into swiftlang:main Mar 29, 2023
@bnbarham bnbarham deleted the refactor-refactoring-collection branch March 29, 2023 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants