Skip to content
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

Feature Request: Bulk Removal of Enum Case in Swift #78118

Open
shishawn opened this issue Dec 11, 2024 · 0 comments
Open

Feature Request: Bulk Removal of Enum Case in Swift #78118

shishawn opened this issue Dec 11, 2024 · 0 comments
Labels
feature A feature request or implementation refactoring Area → source tooling: refactoring source tooling Area: IDE support, SourceKit, and other source tooling SourceKit Area → source tooling: SourceKit

Comments

@shishawn
Copy link

Motivation

Enumerations are widely used in Swift for type safety and clean code. However, removing a case from an enum can be challenging, as it requires:

  1. Manually identifying all places where the enum case is referenced.
  2. Updating these references to handle the removal appropriately, either by replacing them with a default behavior or removing unreachable code.
    This process is error-prone, especially in large codebases where enums are used extensively.

Proposed solution

Update Swift’s refactoring capabilities with a "Remove Enum Case" functionality that:

  1. Allows a developer to select an enum case for removal.
  2. Automatically identifies and updates all references to the case across the codebase.
  3. Removes references where appropriate, specifically:
    a. In switch statements, remove the corresponding reference.
    b. Remove the entire switch statement if the removed case was its sole clause.
  4. Replaces references with placeholders for manual intervention when they cannot be safely removed or modified automatically.

Alternatives considered

N/A

Additional information

No response

@shishawn shishawn added feature A feature request or implementation triage needed This issue needs more specific labels labels Dec 11, 2024
@AnthonyLatsis AnthonyLatsis added refactoring Area → source tooling: refactoring source tooling Area: IDE support, SourceKit, and other source tooling SourceKit Area → source tooling: SourceKit and removed triage needed This issue needs more specific labels labels Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A feature request or implementation refactoring Area → source tooling: refactoring source tooling Area: IDE support, SourceKit, and other source tooling SourceKit Area → source tooling: SourceKit
Projects
None yet
Development

No branches or pull requests

2 participants