Zulip Chat Archive
Stream: lean4 dev
Topic: Adjusting error ranges for `by`, etc (RFC #8919)
Aaron Hill (Sep 07 2025 at 02:25):
I'm interested in working on https://github.com/leanprover/lean4/issues/8919 . Based on my current understanding, implementing this is going to require:
- Adjusting
Lean.MonadRef(and all of the structures which implement it) to additionaly store something likefullRef: Option (m Syntax). This will be used to store the 'full'Syntaxassociated with a message - in thebyexample, this will be the entireby ...expression, whilerefwill start storing just thebytoken. - Remove
BaseMessage.keepFullRange, and instead storefullPos/endFullPospositions (which will be populated from the newfullReffromLean.MonadRef) - Adjust
msgToInteractiveDiagnosticto directly constructrangeandfullRangefrompos/endPosandfullPos/endFullPosrespectively. This function will no longer ever perform truncation of ranges that span more than one line.
Does that sound correct? I'm unsure about exactly what the API for getting/setting fullRef should like - I assume that we'll want to make it difficult to accidentally update either ref/fullRef without explicitly setting or clearing the other.
Marc Huisinga (Sep 15 2025 at 11:54):
Your plan is good, but since this will require fairly deep changes to multiple components (including the VS Code extension since the new ranges won't satisfy some invariants that the old ones satisfied), I think that it's best implemented by someone at the FRO at some point.
Last updated: Dec 20 2025 at 21:32 UTC