Skip to content

Code action to convert between early-exit if and guard #1569

@AppAppWorks

Description

@AppAppWorks

Description

Sometimes it would be helpful to convert between an early-exit if statement and a guard statement, either to better express the semantics of early-exit, or the code block within the early-exit statement has become overly long.

e.g. convert between

if let a {
  // code block A
  return a
}
// code block B
return b

and

guard let a else {
  // code block B
  return b
}
// code block A
return a

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

    Development

    No branches or pull requests

    Issue actions