sourcekit-lsp
sourcekit-lsp copied to clipboard
Add CodeAction to invert if condition and swap branches
Description
SourceKit-LSP lacks a refactoring to invert a negated if condition while preserving semantics.
I propose a syntax-only refactor that rewrites:
if !cond {
thenBranch()
} else {
elseBranch()
}
into:
if cond {
elseBranch()
} else {
thenBranch()
}
The refactoring should only apply when the condition is syntactically negated and an else branch exists.