Skip to content

Add a Refactoring Action for Converting Implicitly Unwrapped Optionals to Proper Optionals #1320

@CodaFi

Description

@CodaFi
Contributor

Description

Add a refactoring action that converts T! to T? for all types T. At first blush, this appears to be possible by converting ImplicitlyUnwrappedOptionalTypeSyntax nodes to OptionalTypeSyntax nodes without changing the underlying type syntax for T.

As an aside, I think we may not necessarily want to go the other way (T? to T!) since it's generally not great Swift style.

Activity

ahoppen

ahoppen commented on May 18, 2024

@ahoppen
Member

Synced to Apple’s issue tracker as rdar://128310729

changed the title [-]Add a Refactoring Action for Converting IUOs to Proper Optionals[/-] [+]Add a Refactoring Action for Converting implicitly unwrapped optionals to proper optionals[/+] on Jun 8, 2024
changed the title [-]Add a Refactoring Action for Converting implicitly unwrapped optionals to proper optionals[/-] [+]Add a Refactoring Action for Converting Implicitly Unwrapped Optionals to Proper Optionals[/+] on Jun 8, 2024
AbdAlRahmanGad

AbdAlRahmanGad commented on Feb 28, 2025

@AbdAlRahmanGad
Contributor

Hi @ahoppen,

I'm trying to contribute to sourcekit-lsp.

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 sourcekit-lsp successfully.

AbdAlRahmanGad

AbdAlRahmanGad commented on Feb 28, 2025

@AbdAlRahmanGad
Contributor

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?

ahoppen

ahoppen commented on Feb 28, 2025

@ahoppen
Member

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 😉

AbdAlRahmanGad

AbdAlRahmanGad commented on Mar 1, 2025

@AbdAlRahmanGad
Contributor

Is it okay if I worked on issue #1246 as it's the only good first issue right now?

ahoppen

ahoppen commented on Mar 3, 2025

@ahoppen
Member

Yes, please go ahead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    code actionCode action provided by LSPenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @CodaFi@ahoppen@AbdAlRahmanGad

      Issue actions

        Add a Refactoring Action for Converting Implicitly Unwrapped Optionals to Proper Optionals · Issue #1320 · swiftlang/sourcekit-lsp