lean4-htt/tests/server_interactive
Marc Huisinga 25bab8bcc4
feat: server-side support for incremental diagnostics (#13260)
This PR adds server-side support for incremental diagnostics via a new
`isIncremental` field on `PublishDiagnosticsParams` that is only used by
the language server when clients set `incrementalDiagnosticSupport` in
`LeanClientCapabilities`.

### Context

The goal of this new feature is to avoid quadratic reporting of
diagnostics.

LSP has two means of reporting diagnostics; pull diagnostics (where the
client decides when to fetch the diagnostics of a project) and push
diagnostics (where the server decides when to update the set of
diagnostics of a file in the client).
Pull diagnostics have the inherent problem that clients need to
heuristically decide when the set of diagnostics should be updated, and
that diagnostics can only be incrementally reported per file, so the
Lean language server has always stuck with push diagnostics instead.
In principle, push diagnostics were also intended to only be reported
once for a full file, but all major language clients also support
replacing the old set of diagnostics for a file when a new set of
diagnostics is reported for the same version of the file, so we have
always reported diagnostics incrementally while the file is being
processed in this way.
However, this approach has a major limitation: all notifications must be
a full set of diagnostics, which means that we have to report a
quadratic amount of diagnostics while processing a file to the end.

### Semantics

When `LeanClientCapabilities.incrementalDiagnosticSupport` is set, the
language server will set `PublishDiagnosticsParams.isIncremental` when
it is reporting a set of diagnostics that should simply be appended to
the previously reported set of diagnostics instead of replacing it.
Specifically, clients implementing this new feature should implement the
following behaviour:
- If `PublishDiagnosticsParams.isIncremental` is `false` or the field is
missing, the current diagnostic report for a specific document should
replace the previous diagnostic report for that document instead of
appending to it. This is identical to the current behavior before this
PR.
- If `PublishDiagnosticsParams.isIncremental` is `true`, the current
diagnostic report for a specific document should append to the previous
diagnostic report for that document instead of replacing it.
- Versions should be ignored when deciding whether to replace or append
to a previous set of diagnostics. The language server ensures that the
`isIncremental` flag is set correctly.

### Client-side implementation

A client-side implementation for the VS Code extension can be found at
[vscode-lean4#752](https://github.com/leanprover/vscode-lean4/pull/752).

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Wojciech Nawrocki <13901751+Vtec234@users.noreply.github.com>
2026-04-21 12:48:15 +00:00
..
533.lean
533.lean.out.expected
863.lean
863.lean.out.expected
1018unknowMVarIssue.lean
1018unknowMVarIssue.lean.out.expected
1031.lean
1265.lean
1265.lean.out.expected
1403.lean
1403.lean.out.expected
1525.lean
1659.lean
1659.lean.out.expected
2058.lean
2058.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
2881.lean
2881.lean.out.expected
4078.lean
4078.lean.out.expected
4880.lean
4880.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
5659.lean
5659.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
6594.lean
6594.lean.out.expected fix: filter assigned metavariables before computing apply subgoal tags (#13476) 2026-04-19 14:31:49 +00:00
10898.lean
10898.lean.out.expected
amb.lean
amb.lean.out.expected
anonHyp.lean
anonHyp.lean.out.expected
autoBoundIssue.lean
autoBoundIssue.lean.out.expected
builtinCodeactions.lean
builtinCodeactions.lean.out.expected
cancellation.lean
cancellation.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
catHover.lean
catHover.lean.out.expected
codeaction.lean
codeaction.lean.out.expected
codeActions.lean
codeActions.lean.out.expected
compHeader.lean
compHeader.lean.out.expected
completion.lean
completion.lean.out.expected
completion2.lean
completion2.lean.out.expected
completion3.lean
completion3.lean.out.expected
completion4.lean
completion4.lean.out.expected
completion5.lean
completion5.lean.out.expected
completion6.lean
completion6.lean.out.expected
completion7.lean
completion7.lean.out.expected
completionAtPrint.lean
completionAtPrint.lean.out.expected
completionBracketedDot.lean
completionBracketedDot.lean.out.expected
completionCheck.lean
completionCheck.lean.out.expected
completionDanglingDot.lean
completionDanglingDot.lean.out.expected
completionDeprecation.lean
completionDeprecation.lean.out.expected
completionEmptyBy.lean fix: tactic completion in empty by blocks (#13348) 2026-04-15 08:39:55 +00:00
completionEmptyBy.lean.out.expected fix: tactic completion in empty by blocks (#13348) 2026-04-15 08:39:55 +00:00
completionEmptyByBracketed.lean fix: tactic completion in empty by blocks (#13348) 2026-04-15 08:39:55 +00:00
completionEmptyByBracketed.lean.out.expected fix: tactic completion in empty by blocks (#13348) 2026-04-15 08:39:55 +00:00
completionEndSection.lean
completionEndSection.lean.out.expected
completionEOF.lean
completionEOF.lean.out.expected
completionFallback.lean
completionFallback.lean.out.expected
completionFromExpectedType.lean
completionFromExpectedType.lean.out.expected
completionIStr.lean
completionIStr.lean.out.expected
completionOpenNamespaces.lean
completionOpenNamespaces.lean.out.expected
completionOption.lean
completionOption.lean.out.expected
completionPrefixIssue.lean
completionPrefixIssue.lean.out.expected
completionPrivateTypes.lean
completionPrivateTypes.lean.out.expected
completionPrv.lean
completionPrv.lean.out.expected
completionStructureInstance.lean
completionStructureInstance.lean.out.expected
completionTactics.lean fix: tactic completion in empty by blocks (#13348) 2026-04-15 08:39:55 +00:00
completionTactics.lean.out.expected fix: tactic completion in empty by blocks (#13348) 2026-04-15 08:39:55 +00:00
compNamespace.lean
compNamespace.lean.out.expected
definition.lean
definition.lean.out.expected
Diff.lean
Diff.lean.out.expected feat: update RPC wire format (#12905) 2026-03-13 23:46:16 +00:00
discrsIssue.lean
discrsIssue.lean.out.expected
docstringLinksExamples.lean
docstringLinksExamples.lean.out.expected
documentSymbols.lean
documentSymbols.lean.out.expected
dotIdCompletion.lean
dotIdCompletion.lean.out.expected
dottedIdentNotation.lean
dottedIdentNotation.lean.out.expected
editAfterError.lean
editAfterError.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
editCompletion.lean
editCompletion.lean.out.expected
errorExplanationInteractive.lean
errorExplanationInteractive.lean.out.expected
expectedTypeAsGoal.lean
expectedTypeAsGoal.lean.out.expected
explicitAppInstHole.lean
explicitAppInstHole.lean.out.expected
findReferences.lean
findReferences.lean.out.expected
foldingRange.lean
foldingRange.lean.out.expected
fvarIdCollision.lean
fvarIdCollision.lean.out.expected
ghostGoals.lean
ghostGoals.lean.out.expected
goalEOF.lean
goalEOF.lean.out.expected
goalIssue.lean
goalIssue.lean.out.expected
goalsAccomplished.lean
goalsAccomplished.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
goTo.lean
goTo.lean.out.expected
goTo2.lean
goTo2.lean.out.expected
guardMsgsCodeAction.lean
guardMsgsCodeAction.lean.out.expected
haveInfo.lean
haveInfo.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
highlight.lean
highlight.lean.out.expected
highlightMatches.lean
highlightMatches.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
hover.lean
hover.lean.out.expected
hoverAt.lean
hoverAt.lean.out.expected
hoverBinderUnderscore.lean
hoverBinderUnderscore.lean.out.expected
hoverDoForIn.lean fix: add term info for for loop variables in new do elaborator (#13399) 2026-04-13 20:29:55 +00:00
hoverDoForIn.lean.out.expected fix: add term info for for loop variables in new do elaborator (#13399) 2026-04-13 20:29:55 +00:00
hoverDot.lean
hoverDot.lean.out.expected
hoverException.lean
hoverException.lean.out.expected
hoverMatch.lean
hoverMatch.lean.out.expected
hoverTacticExt.lean
hoverTacticExt.lean.out.expected
importCompletion.lean
importCompletion.lean.out.expected
incomingCallHierarchy.lean
incomingCallHierarchy.lean.out.expected
incomingCallHierarchyWhere.lean
incomingCallHierarchyWhere.lean.out.expected
incrementalCombinator.lean
incrementalCombinator.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
incrementalCommand.lean
incrementalCommand.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
incrementalInduction.lean
incrementalInduction.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
incrementalMutual.lean
incrementalMutual.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
incrementalTactic.lean
incrementalTactic.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
infoIssues.lean
infoIssues.lean.out.expected
inlayHints.lean
inlayHints.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
interactiveDiagnostics.lean
interactiveDiagnostics.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
interactiveGoalGoToLoc.lean
interactiveGoalGoToLoc.lean.out.expected feat: update RPC wire format (#12905) 2026-03-13 23:46:16 +00:00
interactiveGoalPopups.lean
interactiveGoalPopups.lean.out.expected feat: update RPC wire format (#12905) 2026-03-13 23:46:16 +00:00
interactiveTermGoals.lean
interactiveTermGoals.lean.out.expected feat: update RPC wire format (#12905) 2026-03-13 23:46:16 +00:00
interactiveTraces.lean
interactiveTraces.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
internalNamesIssue.lean
internalNamesIssue.lean.out.expected
inWordCompletion.lean
inWordCompletion.lean.out.expected
isRflParallel.lean
issue4527.lean
issue4527.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
issue5021.lean
issue5021.lean.out.expected
issue5597.lean
issue5597.lean.out.expected
jumpMutual.lean
jumpMutual.lean.out.expected
keywordCompletion.lean
keywordCompletion.lean.out.expected
lean3HoverIssue.lean
lean3HoverIssue.lean.out.expected
macroGoalIssue.lean
macroGoalIssue.lean.out.expected
match.lean
match.lean.out.expected
matchPatternHover.lean
matchPatternHover.lean.out.expected
matchStxCompletion.lean
matchStxCompletion.lean.out.expected
moduleHierarchyImports.lean
moduleHierarchyImports.lean.out.expected
outgoingCallHierarchy.lean
outgoingCallHierarchy.lean.out.expected
partialNamespace.lean
partialNamespace.lean.out.expected
plainGoal.lean feat: require indentation in commands, allow empty tactic sequences (#13229) 2026-04-08 14:05:47 +00:00
plainGoal.lean.out.expected feat: require indentation in commands, allow empty tactic sequences (#13229) 2026-04-08 14:05:47 +00:00
plainGoalEmptyBy.lean feat: require indentation in commands, allow empty tactic sequences (#13229) 2026-04-08 14:05:47 +00:00
plainGoalEmptyBy.lean.out.expected feat: require indentation in commands, allow empty tactic sequences (#13229) 2026-04-08 14:05:47 +00:00
plainTermGoal.lean
plainTermGoal.lean.out.expected
ppShowLetValues.lean
ppShowLetValues.lean.out.expected
rename.lean
rename.lean.out.expected
run_test.lean
run_test.sh chore: check test output before exit code in piles (#12947) 2026-03-17 16:34:21 +00:00
rwElabConst.lean
rwElabConst.lean.out.expected
semanticTokens.lean
semanticTokens.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
semanticTokensVersoDocs.lean
semanticTokensVersoDocs.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
signatureHelp.lean
signatureHelp.lean.out.expected
stdOutput.lean
strInterpSynthError.lean
strInterpSynthError.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
structInstFieldHints.lean
structInstFieldHints.lean.out.expected
structNameParentProj.lean
structNameParentProj.lean.out.expected
tacticInduction.lean
tacticInduction.lean.out.expected
terminationBySuggestion.lean
terminationBySuggestion.lean.out.expected
travellingCompletions.lean
travellingCompletions.lean.out.expected
tryThisCodeAction.lean
tryThisCodeAction.lean.out.expected
unknownIdentifierCodeActions.lean
unknownIdentifierCodeActions.lean.out.expected
unterminatedDocComment.lean
unterminatedDocComment.lean.out.expected feat: server-side support for incremental diagnostics (#13260) 2026-04-21 12:48:15 +00:00
userWidget.lean feat: update RPC wire format (#12905) 2026-03-13 23:46:16 +00:00
userWidget.lean.out.expected
workspaceSymbols.lean
workspaceSymbols.lean.out.expected