Skip to content

feat: support code actions in linters#14402

Open
wkrozowski wants to merge 18 commits into
leanprover:masterfrom
wkrozowski:wojciech/lintersCodeActions
Open

feat: support code actions in linters#14402
wkrozowski wants to merge 18 commits into
leanprover:masterfrom
wkrozowski:wojciech/lintersCodeActions

Conversation

@wkrozowski

@wkrozowski wkrozowski commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

This PR adds the support for code actions to linters. When Elab.async is enabled, before a linter task is dispatched, we create a promise for the info tree node. Then, we accumulate newly added info trees through the linter execution and we resolve the promise inside of the linter task. Finally, on the main task, we modify the info tree (wrapped in command context) and add a new leaf, with an mvar id, that will eventually be filled with a promise value.

This PR also supports code actions in stateful linters (#14357), but does not offer such support for module linters, that fire at terminal commands and code actions from there do not surface to the info view.

Related to RFC #4363.

@wkrozowski wkrozowski added the changelog-language Language features and metaprograms label Jul 15, 2026
@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 Jul 15, 2026
@mathlib-lean-pr-testing

mathlib-lean-pr-testing Bot commented Jul 15, 2026

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 46cf2b9ead5df46fbb91e45cf58e5764717767d5 --onto a4b639c5a1e545677b36b09a4770b7b559df805b. You can force Mathlib CI using the force-mathlib-ci label. (2026-07-15 19:04:08)
  • ✅ Mathlib branch lean-pr-testing-14402 has successfully built against this PR. (2026-07-16 16:13:06) View Log
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 9a61e83457592524905308f1fb63b4a5ebdcebd1 --onto 25ba8c3d3bcb1dded7ff5a6f3b6044b0a7970198. You can force Mathlib CI using the force-mathlib-ci label. (2026-07-20 12:09:18)

@leanprover-bot

leanprover-bot commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 46cf2b9ead5df46fbb91e45cf58e5764717767d5 --onto a4b639c5a1e545677b36b09a4770b7b559df805b. You can force reference manual CI using the force-manual-ci label. (2026-07-15 19:04:10)
  • ✅ Reference manual branch lean-pr-testing-14402 has successfully built against this PR. (2026-07-16 15:19:12) View Log
  • 🟡 Reference manual branch lean-pr-testing-14402 build against this PR didn't complete normally. (2026-07-16 15:19:20) View Log
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 9a61e83457592524905308f1fb63b4a5ebdcebd1 --onto 49ff95727f98d43984726b26742d17a1ceea9dd5. You can force reference manual CI using the force-manual-ci label. (2026-07-20 12:09:19)

@wkrozowski
wkrozowski marked this pull request as ready for review July 16, 2026 14:04
@wkrozowski

Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-radar

leanprover-radar commented Jul 16, 2026

Copy link
Copy Markdown

Benchmark results for 3543a67 against 46cf2b9 are in. There are significant results. @wkrozowski

  • 🟥 build//instructions: +10.0G (+0.09%)

Large changes (1✅)

  • build/profile/interpretation//wall-clock: -2s (-2.44%)

Small changes (1✅, 8🟥)

  • 🟥 build/lakeprof/longest rebuild path//instructions: +7.1G (+1.16%)
  • 🟥 build/module/Lean.Elab.Command//instructions: +6.9G (+45.02%) (reduced significance based on *//lines)
  • 🟥 build/module/Lean.Elab.InfoTree.Basic//instructions: +61.2M (+3.26%) (reduced significance based on *//lines)
  • 🟥 build/module/Lean.Meta.Tactic.Grind.Arith.ModelUtil//instructions: +59.5M (+2.53%)
  • 🟥 build/profile/linting//wall-clock: +1s (+5.17%)
  • 🟥 compiled/rbmap_fbip//task-clock: +31ms (+9.47%)
  • 🟥 compiled/rbmap_fbip//wall-clock: +31ms (+9.46%)
  • 🟥 elab/big_beq//maxrss: +11MiB (+0.59%)
  • elab/big_do//instructions: -22.4M (-0.12%)

@wkrozowski
wkrozowski force-pushed the wojciech/lintersCodeActions branch from 3543a67 to ed65cc9 Compare July 16, 2026 14:27
@github-actions github-actions Bot added the mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN label Jul 16, 2026
@leanprover-bot leanprover-bot added the builds-manual CI has verified that the Lean Language Reference builds against this PR label Jul 16, 2026
@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-manual CI has verified that the Lean Language Reference builds against this PR builds-mathlib CI has verified that Mathlib builds against this PR changelog-language Language features and metaprograms mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN 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.

3 participants