Skip to content

Tracking Issue for improving suggestion rendering in diagnostics #141973

Open
@estebank

Description

@estebank

This is a tracking issue for the prioritizing "verbose" or "hidden" suggestions over "inline" (the default given by span_suggestion suggestions.

Inline suggestions have several issues that make them less readable than verbose ones:

  • I've seen people get confused by them
  • Small differences caused by typos are much better seen on the verbose output, where the highlighting now points at the exact character, instead of having to visually notice the different text in non-aligned places
  • The inline output was the original implementation, but since we've introduced the diff output which is clearer on what we expect the user to write
  • For additions, things like "add a type parameter: " are even more unclear
  • Relying on the inline suggestions have lead us to use worse spans on purpose because otherwise the rendering would be bad (like skipping whitespace in some cases) and has a tendency to make suggestion mistakes harder to notice (broken suggestions making it in because we couldn't tell during review)
  • When a single suggestion is in the diagnostic, the default renders inline, but if there are two, then both get rendered as verbose, which makes the output sometimes sensitive to what was emitted and can cause two similar errors to look very different.

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.

Steps

  • Audit all cases of span_suggestion uses.
  • Adjust individual cases to be either span_suggestion_verbose, span_suggestion_hidden or span_suggestion_tool_only
  • Change span_suggestion to span_suggestion_inline and span_suggestion_verbose to span_suggestion

Implementation history

https://rust-lang.zulipchat.com/#narrow/channel/147480-t-compiler.2Fdiagnostics/topic/Why.20are.20we.20making.20suggestions.20verbose.3F

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: Diagnostics

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions