Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Clear Diagnostics when file is closed #1591

Merged
merged 21 commits into from
Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a0440fc
fix: LSP Change 'info' to 'hint' to eliminate noisy blue squiggles sh…
lovettchris Sep 12, 2022
b66b2a7
undo change to .hint for informational messages.
lovettchris Sep 13, 2022
ebb1e57
fix: CR feedback, move the exitWorker function.
lovettchris Sep 13, 2022
811c32d
fix: remove blank line
lovettchris Sep 13, 2022
9cdac72
Merge remote-tracking branch 'upstream/master' into clovett/clear_pro…
lovettchris Sep 19, 2022
1b98766
fix hang in the tests
lovettchris Sep 19, 2022
8f30109
fix: code review feedback.
lovettchris Sep 19, 2022
380728d
fix: add lspShutdown helper method that does the property handshake.
lovettchris Sep 20, 2022
85cfbda
fix: move shutdown code out of Communication.lean.
lovettchris Sep 23, 2022
c42a70b
fix: move clear diagnostics on file close to Watchdog.
lovettchris Sep 23, 2022
79c331b
Merge branch 'master' into clovett/clear_problems
lovettchris Sep 26, 2022
761460d
fix: revert unnecessary changes.
lovettchris Sep 26, 2022
665bf37
fix: use repeat instead of while True
lovettchris Sep 26, 2022
bde17e8
Merge branch 'master' into clovett/clear_problems
lovettchris Oct 4, 2022
3d27b26
fix: remove blank lines
lovettchris Oct 4, 2022
c9832a9
fix: fix race condition to ensure clearing of diagnostics is really a…
lovettchris Oct 4, 2022
36a531d
fix: ensure forwardMessages finds the updated WorkState.
lovettchris Oct 4, 2022
7ca3a41
fix: remove trace statement.
lovettchris Oct 4, 2022
8969ee8
fix: code review feedback.
lovettchris Oct 6, 2022
6f614a6
fix: code review - revert unneccesary edits.
lovettchris Oct 7, 2022
6d8b8a5
Merge branch 'master' into clovett/clear_problems
lovettchris Oct 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/Lean/Server/FileWorker.lean
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,16 @@ section Updates
validSnaps := validSnaps.dropLast
unfoldCmdSnaps newMeta validSnaps.toArray cancelTk ctx
modify fun st => { st with doc := ⟨newMeta, AsyncList.delayed newSnaps, cancelTk⟩ }

/-- called when document is closed so we can clear any diagnostics and cancel pending work -/
def exitWorker : WorkerM Unit := do
lovettchris marked this conversation as resolved.
Show resolved Hide resolved
let ctx ← read
let state ← get
let doc := state.doc
let meta := doc.meta
publishDiagnostics meta #[] ctx.hOut
doc.cancelTk.set

end Updates

/- Notifications are handled in the main thread. They may change global worker state
Expand Down Expand Up @@ -451,8 +461,7 @@ section MainLoop
handleRequest id method (toJson params)
mainLoop
| Message.notification "exit" none =>
let doc := (←get).doc
doc.cancelTk.set
exitWorker
lovettchris marked this conversation as resolved.
Show resolved Hide resolved
return ()
| Message.notification method (some params) =>
handleNotification method (toJson params)
Expand Down
2 changes: 1 addition & 1 deletion src/Lean/Widget/InteractiveDiagnostic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def msgToInteractiveDiagnostic (text : FileMap) (m : Message) (hasWidgets : Bool
let range : Range := ⟨low, high⟩
let fullRange : Range := ⟨low, fullHigh⟩
let severity? := some <| match m.severity with
| .information => .information
| .information => .hint
| .warning => .warning
| .error => .error
let source? := some "Lean 4"
Expand Down