Provide quick fixes for error/warning messages
Idea
Attach recommended fixes to error/warning messages that can be solved "easily", e.g.:
- Unused variables/type parameters/imports
- This could have multiple 'fixes':
- Remove the variable
- Rename the variable to
_
in the case of parameters - Prefix the variable with
_
if #135 were to be implemented etc.
- This could have multiple 'fixes':
- Duplicate imports
- Required (but undeclared) language extensions
- Redundant (implied) language extensions
- Missing top-level type signatures
- Uninitialized record fields (see #125)
- Unused do-bindings (see #134)
- Migrations in the case of source breaks (e.g. if #135 were to be implemented)
- Case mode rename suggestions
- etc.
Motivation
Having a unified solution for attaching fixes to a message, would make it easy to emit messages like this one from GHC:
import Prelude (True)
src/ImportSyntaxCheck/ImportDataConstr.hs:1:17: error:
In module ‘Prelude’:
‘True’ is a data constructor of ‘Bool’
To import it use
import Prelude( Bool( True ) )
or
import Prelude( Bool(..) )
|
1 | import Prelude (True)
| ^^^^
This would also enable downstream features like language server support for fixable errors and subsequently improve the editing experience for Curry in LSP-supporting editors, as in this Rust example:
Edited by Fredrik Wieczerkowski