Skip to content

feat: expose fields required for implementing linters outside of Lean core with detailed auto-fixes and diagnostic tags #13610

Draft
wvhulle wants to merge 4 commits intoleanprover:masterfrom
wvhulle:message-diagnostic-fields
Draft

feat: expose fields required for implementing linters outside of Lean core with detailed auto-fixes and diagnostic tags #13610
wvhulle wants to merge 4 commits intoleanprover:masterfrom
wvhulle:message-diagnostic-fields

Conversation

@wvhulle
Copy link
Copy Markdown

@wvhulle wvhulle commented May 2, 2026

This PR exposes metadata otherwise inaccessible to users implementing linters such as diagnostic tags and data. This allows defining diagnostics in more detail as well as replacements, code actions and custom formatting of deprecated or unused syntax.

See how I am currently using this at https://codeberg.org/wvhulle/heron

This PR is kind of more urgent compared to my other PRs. Without direct access to this data, I have to resort to workarounds which don't work nicely with most editors.

Nix changes can be dropped. Another PR is open for them.

@wvhulle wvhulle force-pushed the message-diagnostic-fields branch from 540709f to 7eadf90 Compare May 2, 2026 16:03
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label May 2, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

mathlib-lean-pr-testing Bot commented May 2, 2026

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 508a1132422faa6d0a35a135909ddc0526910783 --onto 0a6c31520b2ebaa6e71227454b46ebfb4986ae7b. You can force Mathlib CI using the force-mathlib-ci label. (2026-05-02 16:48:42)
  • ❗ Mathlib CI can not be attempted yet, as the nightly-testing-2026-05-02 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-mathlib, Mathlib CI should run now. You can force Mathlib CI using the force-mathlib-ci label. (2026-05-02 18:23:39)

@leanprover-bot
Copy link
Copy Markdown
Collaborator

leanprover-bot commented May 2, 2026

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 508a1132422faa6d0a35a135909ddc0526910783 --onto 3fc99eef102549c743c6c63547983319bfae6f01. You can force reference manual CI using the force-manual-ci label. (2026-05-02 16:48:43)
  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-05-02 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2026-05-02 18:23:41)

wvhulle added 4 commits May 2, 2026 19:31
Pulls these LSP types into their own prelude-friendly modules so
downstream code (linters, widget bridges) can depend on them without
importing the full Diagnostics module.
Adds the three diagnostic fields to Message and threads them through
Log and the InteractiveDiagnostic widget bridge so the LSP layer can
emit them. Also preserves infoState on linter messages so consumers
can attach quick-fix code actions.
Updates Lean's built-in deprecated and unused-variable linters to use
the new diagnosticTags field so editors render strikethrough/grey
appropriately. Demonstrates the consumer pattern downstream linters
will follow.
@wvhulle wvhulle force-pushed the message-diagnostic-fields branch from 7eadf90 to b41cf5f Compare May 2, 2026 17:31
@wvhulle wvhulle changed the title Message diagnostic fields feat: expose fields required for implementing linters outside of Lean core with detailed auto-fixes and diagnostic tags May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants