feat(lint): self-documenting Rslint diagnostics — hover, clickable rule docs, playground - #28
Merged
Merged
Conversation
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.
There was a problem hiding this comment.
💡 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".
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Client-side half of #27 — Rslint diagnostics now explain themselves in the editor:
// rslint-disable-next-line …(all four directive forms,eslint-prefix equivalents, comma lists,--trailers) showsRslint(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 advertiseshoverProvider.[rule-id]message prefix intoDiagnostic.code+ docs target and strips it from the message. Transitional by design: it yields automatically once the server publishescodenatively, and unmatched messages pass through untouched.DiagnosticTagrendering, hover descriptions and unused-directive reporting stay upstream work.Recorded as the eighth adaptation in
packages/vscode/AGENTS.md; new terms (Inline directive, Rule docs link) inCONTEXT.md.Related Links
Checklist