This PR reduces the memory consumption of the language server (the watchdog process in particular). In Mathlib, it reduces memory consumption by about 1GB. It also fixes two bugs in the call hierarchy: - When an open file had import errors (e.g. from a transitive build failure), the call hierarchy would not display any usages in that file. Now we use the reference information from the .ilean instead. - When a command would not set a parent declaration (e.g. `#check`), the result was filtered from the call hierarchy. Now we display it as `[anonymous]` instead.
20 lines
602 B
Text
20 lines
602 B
Text
import Lean.Data.Lsp
|
|
open Lean.Lsp
|
|
|
|
def main (_ : List String) : IO Unit := do
|
|
Ipc.runWith "lean" (#["--server"]) do
|
|
let capabilities := {
|
|
textDocument? := some {
|
|
completion? := some {
|
|
completionItem? := some {
|
|
insertReplaceSupport? := true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Ipc.writeRequest ⟨0, "initialize", { capabilities : InitializeParams }⟩
|
|
discard <| Ipc.readResponseAs 0 InitializeResult
|
|
Ipc.writeNotification ⟨"initialized", InitializedParams.mk⟩
|
|
Ipc.waitForWatchdogILeans 1
|
|
Ipc.shutdown 2
|
|
discard <| Ipc.waitForExit
|