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

[SR-6051] Refactoring to expand missing switch cases from switch keyword #48608

Closed
swift-ci opened this issue Oct 3, 2017 · 3 comments
Closed
Labels
feature A feature request or implementation refactoring Area → source tooling: refactoring source tooling Area: IDE support, SourceKit, and other source tooling switch exhaustivity Feature: enforcement of exhaustivity in 'switch' statements switch Feature → statements: 'switch' statements

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Oct 3, 2017

Previous ID SR-6051
Radar None
Original Reporter kacperh (JIRA User)
Type New Feature
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels New Feature, Refactoring
Assignee kacperh (JIRA)
Priority Medium

md5: de49c821e689297adad71d3fdb4c2131

Issue Description:

When enum is defined like:

enum AccountType {
  case savings, checking
}

and code that uses it:

let account: AccountType
switch account { }

we could provide cursor refactoring, which whenever the cursor is anywhere on switch keyword lets a user to expand missing switch cases to the form:

let account: AccountType
switch account {
    case .savings: <#code#>
    case .account: <#code#>
}

This works just like current Expand default but is more convenient to use when user doesn't have default case written yet.

@nkcsgexi
Copy link
Member

nkcsgexi commented Oct 3, 2017

rdar://34758906

@swift-ci
Copy link
Collaborator Author

swift-ci commented Oct 7, 2017

Comment by KacperHarasim (JIRA)

Implemented this in a PR: #12281

@swift-ci
Copy link
Collaborator Author

Comment by KacperHarasim (JIRA)

Merged: 8cd677e

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added source tooling Area: IDE support, SourceKit, and other source tooling switch Feature → statements: 'switch' statements feature A feature request or implementation switch exhaustivity Feature: enforcement of exhaustivity in 'switch' statements and removed new feature labels Jan 28, 2023
This issue was closed.
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 switch exhaustivity Feature: enforcement of exhaustivity in 'switch' statements switch Feature → statements: 'switch' statements
Projects
None yet
Development

No branches or pull requests

3 participants