fix: inlay hint assertion violation (#7164)
This PR fixes an assertion violation introduced in #7149 where the monotonic progress assumption was violated by request cancellation.
This commit is contained in:
parent
2eb478787f
commit
970732ea11
1 changed files with 3 additions and 1 deletions
|
|
@ -126,10 +126,12 @@ def handleInlayHints (p : InlayHintParams) (s : InlayHintState) :
|
|||
let timeSinceLastEditMs := timestamp - lastEditTimestamp
|
||||
inlayHintEditDelayMs - timeSinceLastEditMs
|
||||
let (snaps, _, isComplete) ← ctx.doc.cmdSnaps.getFinishedPrefixWithConsistentLatency editDelayMs.toUInt32 (cancelTk? := ctx.cancelTk.cancellationTask)
|
||||
-- This cancellation check is crucial for the invariant `finishedSnaps >= oldFinishedSnaps` below.
|
||||
RequestM.checkCancelled
|
||||
let snaps := snaps.toArray
|
||||
let finishedSnaps := snaps.size
|
||||
let oldFinishedSnaps := s.oldFinishedSnaps
|
||||
-- File processing is monotonic modulo `didChange` notifications.
|
||||
-- File processing is monotonic modulo `didChange` notifications and cancellation.
|
||||
assert! finishedSnaps >= oldFinishedSnaps
|
||||
-- VS Code emits inlay hint requests *every time the user scrolls*. This is reasonably expensive,
|
||||
-- so in addition to re-using old inlay hints from parts of the file that haven't been processed
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue