-
Notifications
You must be signed in to change notification settings - Fork 302
Add a Refactoring Action for Converting Implicitly Unwrapped Optionals to Proper Optionals #1320
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
Comments
Synced to Apple’s issue tracker as rdar://128310729 |
…1320 - created ConvertIUOToProperOptional that will suggest a conversion when the token in concern is - an IUO; - a direct child of an IUO; or - a direct child of the wrappedType of an IUO. - registered in SyntaxCodeActions.allSyntaxCodeActions - added a test in CodeActionTests - added ConvertIUOToProperOptional.swift to CMakeLists of SourceKitLSP
…1320 - created ConvertImplicitlyUnwrappedOptionalToOptional that will suggest a conversion when the token in concern is - an IUO; - a direct child of an IUO; or - a direct child of the wrappedType of an IUO. - registered in SyntaxCodeActions.allSyntaxCodeActions - added a test in CodeActionTests - added ConvertImplicitlyUnwrappedOptionalToOptional.swift to CMakeLists of SourceKitLSP
Hi @ahoppen, I'm trying to contribute to Could you please point me to where should I implement this change? and how to test the refactoring action? Steps I've taken so far, I've fetched the code and built |
I've just noticed that there is an old draft PR. Should I work on top of it or should I look for another issue? |
Great to hear that you’re interested in contributing. Looks like #1539 has been stale for a while, so I think you could pick it up. That conversation has quite a bit of context as well and I think it turned out that the implementation wouldn’t be trivial because it would be the first global refactoring action except for global rename (which has quite a bit of bespoke logic). But I don’t want to discourage you from trying 😉 |
Is it okay if I worked on issue #1246 as it's the only |
Yes, please go ahead |
Description
Add a refactoring action that converts
T!
toT?
for all typesT
. At first blush, this appears to be possible by convertingImplicitlyUnwrappedOptionalTypeSyntax
nodes toOptionalTypeSyntax
nodes without changing the underlying type syntax forT
.As an aside, I think we may not necessarily want to go the other way (
T?
toT!
) since it's generally not great Swift style.The text was updated successfully, but these errors were encountered: