lean4-htt/tests/lean/server/edits.lean
Leonardo de Moura e9d85f49e6 chore: remove tryPureCoe?
Based on the discussion at
https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/for.2C.20unexpected.20need.20for.20type.20ascription/near/269083574
The consensus seemed to be that "auto pure" is more confusing than its worth.
2022-02-03 16:25:24 -08:00

37 lines
1.3 KiB
Text

import Lean.Data.Lsp
open IO Lean Lsp
def main : IO Unit := do
Ipc.runWith (←IO.appPath) #["--server"] do
let hIn ← Ipc.stdin
hIn.write (←FS.readBinFile "init_vscode_1_47_2.log")
hIn.flush
discard $ Ipc.readResponseAs 0 InitializeResult
Ipc.writeNotification ⟨"initialized", InitializedParams.mk⟩
hIn.write (←FS.readBinFile "open_content.log")
hIn.flush
discard <| Ipc.collectDiagnostics 1 "file:///test.lean" 1
hIn.write (←FS.readBinFile "content_changes.log")
hIn.flush
let diags ← Ipc.collectDiagnostics 2 "file:///test.lean" 7
if diags.isEmpty then
throw $ userError "Test failed, no diagnostics received."
else
let diag := diags.getLast!
FS.writeFile "edits_diag.json.produced" (toString <| toJson (diag : JsonRpc.Message))
if let Except.ok (refDiag : JsonRpc.Notification PublishDiagnosticsParams) :=
(Json.parse $ ←FS.readFile "edits_diag.json") >>= fromJson?
then
assert! (diag == refDiag)
else
throw $ userError "Failed parsing test file."
Ipc.writeRequest ⟨3, "shutdown", Json.null⟩
let shutResp ← Ipc.readResponseAs 3 Json
assert! shutResp.result.isNull
Ipc.writeNotification ⟨"exit", Json.null⟩
discard $ Ipc.waitForExit