Cache invalidation bug in the LSP with following unexpected token
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- developer-experience
Research direction
Start with the minimal reproduction linked in the issue and inspect Lean's language server cache invalidation path for edits that remove a newline after an unexpected token. Trace how the diagnostic is refreshed when the following token changes. Done means the error updates to report def after the described deletion while still updating correctly when the comment alone is removed.
Written by the indexing model from the issue text.
Description
Prerequisites
- Check that your issue is not already filed:
https://github.com/leanprover/lean4/issues - Reduce the issue to a minimal, self-contained, reproducible test case.
Avoid dependencies to Mathlib or Batteries. - Test your test case against the latest nightly release, for example on
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”) - When reporting a perceived soundness bug: Does it affect
lake check --paranoid?
If in doubt, please reach out on [email protected] for responsible disclosure.
Description
When reporting "unexpected token", the error message is not updated if only the following token is updated.
Steps to Reproduce
- Go to https://live.lean-lang.org/#project=lean-nightly&codez=CYUwZgBARgTg9gaxAOwgLggOQIYBd0C8EAFAIwQDUEATAAwBQA9ALTMQDGcAtlyvs43qhIYOABsxcAO4BLZAHNCEAMxA
- See error
unexpected token '/--'; expected ')', ',' or ':' - Select from the start of line 2 to the start of line 3
- Press [Delete]. It's expected that the entirety of line 2
/-- comment -/plus the following newline is removed with only this one keystroke. - Observe that the error message remains the same, even though
/--does not appear in the source code at all
Note that if only /-- comment -/ (without the following newline) is removed, the error message would be correctly updated.
Expected behavior: The error message should be updated to unexpected token 'def'; expected ')', ',' or ':'
Versions
Lean 4.37.0-nightly-2026-11-07
Target: x86_64-unknown-linux-gnu Linux
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
- Dominant language
- Lean
- Stars
- 10.3k
- Forks
- 1.1k
- Avg merge
- 19h 8m
- Merged PRs (30d)
- 421
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from leanprover/lean4
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leanprover/lean4#16681 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
leanprover/lean4#16305 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
leanprover/lean4#16299 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leanprover/lean4#16257 ·
Maintainers usually reply within 1 day
-
`IO.FS.realPath` reports every failure as `noFileOrDirectory` instead of classifying by `errno`Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
leanprover/lean4#15683 ·
Maintainers usually reply within 1 day
All issues in leanprover/lean4
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
speakeasy-api/speakeasy#2159 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
hubverse-org/hubDevs#83 ·
-
garden
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
taecontrol/google-accounts-mcp#92 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day