Skip to content

feat(lint): self-documenting diagnostics — suppression-comment hover, clickable rule docs, diagnostic tags #27

Description

@fi3ework

Summary

Make Rslint diagnostics self-documenting in the editor. Three capabilities, ordered by how much of the work lives in this repo:

  1. Suppression-comment hover — hovering a rule id inside // rslint-disable-next-line no-floating-promises shows that rule's documentation (description + link to rstack.rs). This answers "why is this line suppressed?" directly at the comment. Neither the ESLint nor the Biome extension offers this; Ruff proves the pattern (ruff server answers textDocument/hover over noqa codes).
  2. Clickable rule ids in the Problems panel — populate Diagnostic.codeDescription.href (LSP 3.16) from the rule's docs URL, so the rule id in the Problems panel links straight to the rule's page. dbaeumer.vscode-eslint does exactly this from meta.docs.url.
  3. Diagnostic tags for dead code — emit DiagnosticTag.Unnecessary for unused-variable style rules (rendered faded) and DiagnosticTag.Deprecated for deprecated-API rules (rendered struck-through), so squiggles stay reserved for real errors. Also proven by vscode-eslint.

Where the work lives

Piece Repo Effort
Hover over disable-comment rule ids (languages.registerHoverProvider, derive docs URL from rule id) this repo, client-side 2–3 days
codeDescription.href + DiagnosticTag on published diagnostics Rslint upstream (Go LSP) ~1 day

The client-side hover can ship independently of the upstream half.

Constraints

  • stacks/lint is a deliberate near-verbatim copy of the upstream extension with exactly seven documented adaptations (packages/vscode/AGENTS.md). A client-side hover provider is new behavior, not a divergence inside the copied files — implement it as a separate module registered by the stack, and if it must touch copied files, record it as an eighth adaptation in AGENTS.md.
  • Docs URL derivation should not hardcode a URL scheme per rule; derive from one base URL + rule id, and degrade gracefully (no hover entry) for rules without docs.
  • The upstream half needs an issue/PR on web-infra-dev/rslint; link it here once filed.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions