-
Notifications
You must be signed in to change notification settings - Fork 440
Add convert to trailing closure and editor placeholder refactorings #1485
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
Conversation
This has a couple of differences with the existing placeholder expansion:
BasicFormat still needs some fixes here, but we can do that after. The main one is the missing space between |
4b05750
to
ebfb348
Compare
@swift-ci please test |
@swift-ci please test Windows |
ebfb348
to
4546b2e
Compare
0fa4da4
to
38e564f
Compare
38e564f
to
2329889
Compare
@swift-ci please test |
@swift-ci please test Windows platform |
2329889
to
303c058
Compare
.with(\.leadingTrivia, Trivia() | ||
.merging(triviaOf: closures.first!.original.label) | ||
.merging(triviaOf: closures.first!.original.colon) | ||
.merging(closures.first!.closure.leadingTrivia)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you dropping the trivia of closures.first!.trailingComma
or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's added above. FWIW I added quite a few more comments in the trivia test that hopefully catches all the cases now 😅. Worth checking those as well - IMO there's a few odd spaces that we should probably remove, but I think it's good enough for now.
312186b
to
33a73d9
Compare
@swift-ci please test |
@swift-ci please test Windows platform |
33a73d9
to
7249399
Compare
@swift-ci please test |
@swift-ci please test |
swiftlang/swift-stress-tester#238 @swift-ci please test |
7249399
to
09c1295
Compare
swiftlang/swift-stress-tester#238 @swift-ci please test |
0c9bcea
to
37d87dc
Compare
swiftlang/swift-stress-tester#238 @swift-ci please test |
We now properly strip trailing whitespace. Add in spacing after `{` and before `}`.
This was called `SourceEdit`, which would be nice to reserve for refactorings rather than incremental parsing. Ideally we'd also move all the incremental parsing types into `SwiftParser` as well.
This adds an additional text-based refactoring provider which the original syntax-based provider now implements. This allows refactorings that produce text rather than a full tree.
Adds three new refactorings: - `ConvertToTrailingClosures` - `ExpandEditorPlaceholder` - `ExpandEditorPlaceholders` `ExpandEditorPlaceholders` is a combination of `ExpandEditorPlaceholder` and `ConvertToTrailingClosures`, ie. it first expands any function-typed closures at the end of a call using `ExpandEditorPlaceholder` and then runs `ConvertToTrailingClosures` on that call. Resolves rdar://107532856.
37d87dc
to
c70e54a
Compare
swiftlang/swift-stress-tester#238 @swift-ci please test |
Adds three new refactorings:
ConvertToTrailingClosures
ExpandEditorPlaceholder
ExpandEditorPlaceholders
ExpandEditorPlaceholders
is a combination ofExpandEditorPlaceholder
andConvertToTrailingClosures
, ie. it first expands any function-typed closures at the end of a call usingExpandEditorPlaceholder
and then runsConvertToTrailingClosures
on that call.Resolves rdar://107532856.