Skip to content

feat(lint): self-documenting Rslint diagnostics — hover, clickable rule docs, playground - #28

Merged
fi3ework merged 6 commits into
mainfrom
feat/lint-self-documenting-diagnostics
Aug 21, 2026
Merged

feat(lint): self-documenting Rslint diagnostics — hover, clickable rule docs, playground#28
fi3ework merged 6 commits into
mainfrom
feat/lint-self-documenting-diagnostics

Conversation

@fi3ework

Copy link
Copy Markdown
Member

Summary

Client-side half of #27 — Rslint diagnostics now explain themselves in the editor:

  • Inline-directive hover — hovering a rule id inside // rslint-disable-next-line … (all four directive forms, eslint- prefix equivalents, comma lists, -- trailers) shows Rslint(rule-id) with the id linking to its docs page. Rule ids also get a DocumentLink (ctrl+click) and a persistent underline. One memoized parse per document version feeds all three affordances; the hover stands down if a future server advertises hoverProvider.
  • Clickable rule ids in the Problems panel — the lint middleware lifts the [rule-id] message prefix into Diagnostic.code + docs target and strips it from the message. Transitional by design: it yields automatically once the server publishes code natively, and unmatched messages pass through untouched.
  • No bundled rule knowledge (ADR 0004, added in an earlier commit on this branch): everything derives from one base URL plus the rule id — no rule lists, no descriptions, no network, no settings. Links are best-effort; a mistyped or local-plugin rule id yields a dead link, never an error. DiagnosticTag rendering, hover descriptions and unused-directive reporting stay upstream work.
  • F5 playground fixes — the dev host now gets a floor-satisfying Node materialized by a preLaunchTask (GUI launches skip shell hooks, so it otherwise inherits a desktop node below the lint worker's floor), and the rslint fixture doubles as a region-separated feature showcase.

Recorded as the eighth adaptation in packages/vscode/AGENTS.md; new terms (Inline directive, Rule docs link) in CONTEXT.md.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Client-side half of #27. New lint-stack modules parse Inline directives
(rslint-/eslint- prefixes, all four forms, comma lists, ' -- ' trailers)
into per-rule-id hover (rendered as Rslint(rule-id) with the id linking
to its docs page), DocumentLink and persistent-underline affordances,
sharing one memoized parse per document version. The router middleware
lifts the '[rule-id] ' message prefix into Diagnostic.code +
codeDescription-equivalent target so the Problems panel shows a
clickable rule id; it yields automatically once the server publishes
code itself and passes unmatched messages through untouched.

Everything derives from one base URL plus the rule id — no bundled rule
metadata, no network, no configuration (ADR 0004). The hover provider
stands down if a future server advertises hoverProvider. Recorded as the
eighth adaptation in AGENTS.md.
New suite-hover (isolated fixture) asserts the Rslint(rule-id) hover on
line-0 and mid-file Inline directives, the DocumentLink range over the
rule id token, and the enriched Diagnostic.code with its docs target and
stripped message prefix. The ported suites migrate rule identification
from message-substring matching to the shared diagnosticRuleIdIncludes
accessor, since the rule id now lives in the diagnostic code instead of
the message prose.
A GUI-launched VS Code never runs the contributor's shell hooks, so the
dev host inherits the desktop session's node — often below the lint
worker's runtime floor, at which point Rslint reports version mismatch
and lints nothing. A new preLaunchTask chain (playground node -> watch)
materializes a floor-satisfying Node into a gitignored
.playground/node-bin/ (PATH node if compliant, else the highest
satisfying fnm/nvm/volta/asdf install, filtered by directory name so
only one probe spawns), and launch.json prepends that directory to the
dev host's PATH only — nothing machine-wide changes. The floor is read
from versionCheck.ts, the single source of truth.
The fixture the F5 playground opens now demonstrates every lint
capability in region-separated sections: clickable rule docs in the
Problems panel (a local plugin rule whose derived link deliberately
404s beside native rules that resolve to real pages), Inline-directive
hover/underline/ctrl+click, every directive form (next-line, trailing
disable-line, eslint- prefix, bare wildcard, comma lists with a
description trailer), and the mistyped-id pitfall. Native rules join
the config in a second entry — one entry takes either community plugin
instances or built-in plugin names, never both. The smoke-test contract
is preserved: exactly one null literal, asserted rule set unchanged.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2569927202

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/lint/inlineDirectives.ts
Comment thread packages/vscode/src/stacks/lint/index.ts Outdated
Comment thread packages/vscode/src/stacks/lint/diagnosticEnrichment.ts Outdated
- Prune the controller's runtime capability mirror identity-safely via an
  optional Rslint.onClosed hook, so a same-key runtime replacement created
  during an in-flight close is no longer deleted by the old runtime's
  cleanup (RuntimeManager removes its entry before the async close ends).
- Yield diagnostic enrichment only to an object code (the converted
  server-published codeDescription shape); a future primitive server code
  is preserved as the value while the docs target is still derived and
  the [rule-id] prefix stripped.
- Document the accepted raw-text false-positive trade-off on the inline
  directive comment scanner.
@fi3ework
fi3ework merged commit 0be5644 into main Aug 21, 2026
3 checks passed
@fi3ework
fi3ework deleted the feat/lint-self-documenting-diagnostics branch August 21, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant