-
Notifications
You must be signed in to change notification settings - Fork 339
Open
Labels
code actionCode action provided by LSPCode action provided by LSPgood first issueGood for newcomersGood for newcomers
Description
Description
I Propose adding a code action to remove redundant parentheses in Swift expressions.
Originally discussed here:
#2406 (comment)
Although it was originally discussed as a improvement to the existing demorgan implementation. I figured this was something that could be more generalized.
The action would detect parentheses that do not affect meaning and safely remove them, improving readability while preserving operator precedence and evaluation order.
Example:
Before:
let x = (a + b)
let y = ((foo()))After:
let x = a + b
let y = foo()Open question: should the core detection logic live in swift-syntax so it can be reused by other tools(formatters or linters maybe), or should this be implemented locally in SourceKit-LSP?
If so i think this can be broken down into a couple PRs.
- Implement the core upstream in swift-syntax
- Use that in demorgan implemenation in sourcekit-lsp
- Make a full code action for it in sourcekit-lsp
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
code actionCode action provided by LSPCode action provided by LSPgood first issueGood for newcomersGood for newcomers