-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed as not planned
Labels
help wantedContributions especially welcomeContributions especially welcomeinternalAn internal refactor or improvementAn internal refactor or improvement
Description
Depends on #4183
Add a, for now, optional title or message field to Fix that will be used to replace the DiagnosticKind::autofix_title.
The motivation is that a diagnostic can have multiple potential fixes. For example, the unused variable diagnostic can recommend to either:
- Prefix the variable with an underscore, to intentionally mark it as "this is ok"
- Remove the variable
- Add a noqa suppression comment.
Adding the title to the Fix instead of specifying it on the DiagnosticKind will allow us to model the different diagnostics.
It also has the advantage that the Rust compiler can enforce the requirement that each fixable DiagnosticKind has a message, because it is not stored as part of the Fix.
Tasks
- Add new
titleormessagefield toFix(Option<String>). - Change the constructor methods to take
message: Stringas first argument, except forunspecified*, to avoid having to refactor all calls at once - Serialize the
title/messageas part of theFixin the JSON Emitter - Change the
MessageCodeFrameimplementation to showDiagnosticKind::suggestionif present, or fall back toFix::titleif theDiagnostichas oneFix.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedContributions especially welcomeContributions especially welcomeinternalAn internal refactor or improvementAn internal refactor or improvement