File: .lake/packages/lean4/src/lean/Lean/Server/Watchdog.lean

full_name: Lean.Server.Watchdog.workerCfg
code: def workerCfg : Process.StdioConfig 
goal: IO.Process.StdioConfig

full_name: Lean.Server.Watchdog.WorkerEvent.importsChanged
code: /-- Events that worker-specific tasks signal to the main thread. -/
  inductive WorkerEvent where
    | terminated
    | importsChanged
    | crashed (e : IO.Error)
    | ioError (e : IO.Error)
goal: Lean.Server.Watchdog.WorkerEvent

full_name: Lean.Server.Watchdog.WorkerEvent.crashed
code: /-- Events that worker-specific tasks signal to the main thread. -/
  inductive WorkerEvent where
    | terminated
    | importsChanged
    | crashed (e : IO.Error)
    | ioError (e : IO.Error)
goal: Lean.Server.Watchdog.WorkerEvent

full_name: Lean.Server.Watchdog.WorkerEvent.terminated
code: /-- Events that worker-specific tasks signal to the main thread. -/
  inductive WorkerEvent where
    | terminated
    | importsChanged
    | crashed (e : IO.Error)
    | ioError (e : IO.Error)
goal: Lean.Server.Watchdog.WorkerEvent

full_name: Lean.Server.Watchdog.WorkerEvent.ioError
code: /-- Events that worker-specific tasks signal to the main thread. -/
  inductive WorkerEvent where
    | terminated
    | importsChanged
    | crashed (e : IO.Error)
    | ioError (e : IO.Error)
goal: Lean.Server.Watchdog.WorkerEvent

full_name: Lean.Server.Watchdog.WorkerEvent
code: /-- Events that worker-specific tasks signal to the main thread. -/
  inductive WorkerEvent where
    | terminated
    | importsChanged
    | crashed (e : IO.Error)
    | ioError (e : IO.Error)
goal: Type

full_name: Lean.Server.Watchdog.WorkerState.running
code: inductive WorkerState where
    /-- The watchdog can detect a crashed file worker in two places: When trying to send a message
      to the file worker and when reading a request reply.
      In the latter case, the forwarding task terminates and delegates a `crashed` event to the
      main task. Then, in both cases, the file worker has its state set to `crashed` and requests
      that are in-flight are errored. Upon receiving the next packet for that file worker, the file
      worker is restarted and the packet is forwarded to it. If the crash was detected while writing
      a packet, we queue that packet until the next packet for the file worker arrives. -/
    | crashed (queuedMsgs : Array JsonRpc.Message)
    | running
goal: Lean.Server.Watchdog.WorkerState

full_name: Lean.Server.Watchdog.WorkerState.crashed
code: inductive WorkerState where
    /-- The watchdog can detect a crashed file worker in two places: When trying to send a message
      to the file worker and when reading a request reply.
      In the latter case, the forwarding task terminates and delegates a `crashed` event to the
      main task. Then, in both cases, the file worker has its state set to `crashed` and requests
      that are in-flight are errored. Upon receiving the next packet for that file worker, the file
      worker is restarted and the packet is forwarded to it. If the crash was detected while writing
      a packet, we queue that packet until the next packet for the file worker arrives. -/
    | crashed (queuedMsgs : Array JsonRpc.Message)
    | running
goal: Lean.Server.Watchdog.WorkerState

full_name: Lean.Server.Watchdog.WorkerState
code: inductive WorkerState where
    /-- The watchdog can detect a crashed file worker in two places: When trying to send a message
      to the file worker and when reading a request reply.
      In the latter case, the forwarding task terminates and delegates a `crashed` event to the
      main task. Then, in both cases, the file worker has its state set to `crashed` and requests
      that are in-flight are errored. Upon receiving the next packet for that file worker, the file
      worker is restarted and the packet is forwarded to it. If the crash was detected while writing
      a packet, we queue that packet until the next packet for the file worker arrives. -/
    | crashed (queuedMsgs : Array JsonRpc.Message)
    | running
goal: Type

full_name: Lean.Server.Watchdog.PendingRequestMap
code: abbrev PendingRequestMap 
goal: Type

full_name: Lean.Server.Watchdog.FileWorker.doc
code: structure FileWorker where
    doc                : DocumentMeta
    proc               : Process.Child workerCfg
    commTask           : Task WorkerEvent
    state              : WorkerState
    -- This should not be mutated outside of namespace FileWorker,
    -- as it is used as shared mutable state
    /-- The pending requests map contains all requests that have been received from the LSP client,
    but were not answered yet.
    We need them for forwarding cancellation requests to the correct worker as well as cleanly
    aborting requests on worker crashes. -/
    pendingRequestsRef : IO.Ref PendingRequestMap
goal: Lean.Server.DocumentMeta

full_name: Lean.Server.Watchdog.FileWorker.pendingRequestsRef
code: structure FileWorker where
    doc                : DocumentMeta
    proc               : Process.Child workerCfg
    commTask           : Task WorkerEvent
    state              : WorkerState
    -- This should not be mutated outside of namespace FileWorker,
    -- as it is used as shared mutable state
    /-- The pending requests map contains all requests that have been received from the LSP client,
    but were not answered yet.
    We need them for forwarding cancellation requests to the correct worker as well as cleanly
    aborting requests on worker crashes. -/
    pendingRequestsRef : IO.Ref PendingRequestMap
goal: IO.Ref Lean.Server.Watchdog.PendingRequestMap

full_name: Lean.Server.Watchdog.FileWorker.commTask
code: structure FileWorker where
    doc                : DocumentMeta
    proc               : Process.Child workerCfg
    commTask           : Task WorkerEvent
    state              : WorkerState
    -- This should not be mutated outside of namespace FileWorker,
    -- as it is used as shared mutable state
    /-- The pending requests map contains all requests that have been received from the LSP client,
    but were not answered yet.
    We need them for forwarding cancellation requests to the correct worker as well as cleanly
    aborting requests on worker crashes. -/
    pendingRequestsRef : IO.Ref PendingRequestMap
goal: Task Lean.Server.Watchdog.WorkerEvent

full_name: Lean.Server.Watchdog.FileWorker.proc
code: structure FileWorker where
    doc                : DocumentMeta
    proc               : Process.Child workerCfg
    commTask           : Task WorkerEvent
    state              : WorkerState
    -- This should not be mutated outside of namespace FileWorker,
    -- as it is used as shared mutable state
    /-- The pending requests map contains all requests that have been received from the LSP client,
    but were not answered yet.
    We need them for forwarding cancellation requests to the correct worker as well as cleanly
    aborting requests on worker crashes. -/
    pendingRequestsRef : IO.Ref PendingRequestMap
goal: IO.Process.Child Lean.Server.Watchdog.workerCfg

full_name: Lean.Server.Watchdog.FileWorker
code: structure FileWorker where
    doc                : DocumentMeta
    proc               : Process.Child workerCfg
    commTask           : Task WorkerEvent
    state              : WorkerState
    -- This should not be mutated outside of namespace FileWorker,
    -- as it is used as shared mutable state
    /-- The pending requests map contains all requests that have been received from the LSP client,
    but were not answered yet.
    We need them for forwarding cancellation requests to the correct worker as well as cleanly
    aborting requests on worker crashes. -/
    pendingRequestsRef : IO.Ref PendingRequestMap
goal: Type

full_name: Lean.Server.Watchdog.FileWorker.state
code: structure FileWorker where
    doc                : DocumentMeta
    proc               : Process.Child workerCfg
    commTask           : Task WorkerEvent
    state              : WorkerState
    -- This should not be mutated outside of namespace FileWorker,
    -- as it is used as shared mutable state
    /-- The pending requests map contains all requests that have been received from the LSP client,
    but were not answered yet.
    We need them for forwarding cancellation requests to the correct worker as well as cleanly
    aborting requests on worker crashes. -/
    pendingRequestsRef : IO.Ref PendingRequestMap
goal: Lean.Server.Watchdog.WorkerState

full_name: Lean.Server.Watchdog.FileWorker.stdin
code: def stdin (fw : FileWorker) : FS.Stream 
goal: IO.FS.Stream

full_name: Lean.Server.Watchdog.FileWorker.stdout
code: def stdout (fw : FileWorker) : FS.Stream 
goal: IO.FS.Stream

full_name: Lean.Server.Watchdog.FileWorker.erasePendingRequest
code: def erasePendingRequest (fw : FileWorker) (id : RequestID) : IO Unit 
goal: IO Unit

full_name: Lean.Server.Watchdog.FileWorker.errorPendingRequests
code: def errorPendingRequests (fw : FileWorker) (hError : FS.Stream) (code : ErrorCode) (msg : String)
      : IO Unit 
goal: IO Unit

full_name: Lean.Server.Watchdog.FileWorkerMap
code: abbrev FileWorkerMap 
goal: Type

full_name: Lean.Server.Watchdog.ImportMap
code: abbrev ImportMap 
goal: Type

full_name: Lean.Server.Watchdog.ImportData.importedBy
code: /-- Global import data for all open files managed by this watchdog. -/
  structure ImportData where
    /-- For every open file, the files that it imports. -/
    imports    : ImportMap
    /-- For every open file, the files that it is imported by. -/
    importedBy : ImportMap
goal: Lean.Server.Watchdog.ImportMap

full_name: Lean.Server.Watchdog.ImportData
code: /-- Global import data for all open files managed by this watchdog. -/
  structure ImportData where
    /-- For every open file, the files that it imports. -/
    imports    : ImportMap
    /-- For every open file, the files that it is imported by. -/
    importedBy : ImportMap
goal: Type

full_name: Lean.Server.Watchdog.ImportData.imports
code: /-- Global import data for all open files managed by this watchdog. -/
  structure ImportData where
    /-- For every open file, the files that it imports. -/
    imports    : ImportMap
    /-- For every open file, the files that it is imported by. -/
    importedBy : ImportMap
goal: Lean.Server.Watchdog.ImportMap

full_name: Lean.Server.Watchdog.ImportData.update
code: /-- Updates `d` with the new set of `imports` for the file `uri`. -/
  def ImportData.update (d : ImportData) (uri : DocumentUri) (imports : RBTree DocumentUri compare)
      : ImportData 
goal: Lean.Server.Watchdog.ImportData

full_name: Lean.Server.Watchdog.ImportData.eraseImportsOf
code: /--
  Sets the imports of `uri` in `d` to the empty set.
  -/
  def ImportData.eraseImportsOf (d : ImportData) (uri : DocumentUri) : ImportData 
goal: Lean.Server.Watchdog.ImportData

full_name: Lean.Server.Watchdog.RequestIDTranslation.localID
code: structure RequestIDTranslation where
    sourceUri : DocumentUri
    localID   : RequestID
goal: Lean.JsonRpc.RequestID

full_name: Lean.Server.Watchdog.RequestIDTranslation
code: structure RequestIDTranslation where
    sourceUri : DocumentUri
    localID   : RequestID
goal: Type

full_name: Lean.Server.Watchdog.RequestIDTranslation.sourceUri
code: structure RequestIDTranslation where
    sourceUri : DocumentUri
    localID   : RequestID
goal: Lean.Lsp.DocumentUri

full_name: Lean.Server.Watchdog.PendingServerRequestMap
code: abbrev PendingServerRequestMap 
goal: Type

full_name: Lean.Server.Watchdog.ServerRequestData.pendingServerRequests
code: structure ServerRequestData where
    pendingServerRequests : PendingServerRequestMap
    freshServerRequestID  : Nat
goal: Lean.Server.Watchdog.PendingServerRequestMap

full_name: Lean.Server.Watchdog.ServerRequestData
code: structure ServerRequestData where
    pendingServerRequests : PendingServerRequestMap
    freshServerRequestID  : Nat
goal: Type

full_name: Lean.Server.Watchdog.ServerRequestData.freshServerRequestID
code: structure ServerRequestData where
    pendingServerRequests : PendingServerRequestMap
    freshServerRequestID  : Nat
goal: Nat

full_name: Lean.Server.Watchdog.ServerRequestData.trackOutboundRequest
code: def ServerRequestData.trackOutboundRequest
      (data      : ServerRequestData)
      (sourceUri : DocumentUri)
      (localID   : RequestID)
      : RequestID × ServerRequestData 
goal: Lean.JsonRpc.RequestID × Lean.Server.Watchdog.ServerRequestData

full_name: Lean.Server.Watchdog.ServerRequestData.translateInboundResponse
code: def ServerRequestData.translateInboundResponse
      (data     : ServerRequestData)
      (globalID : RequestID)
      : Option RequestIDTranslation × ServerRequestData 
goal: Option Lean.Server.Watchdog.RequestIDTranslation × Lean.Server.Watchdog.ServerRequestData

full_name: Lean.Server.Watchdog.ServerContext.args
code: structure ServerContext where
    hIn                 : FS.Stream
    hOut                : FS.Stream
    hLog                : FS.Stream
    /-- Command line arguments. -/
    args                : List String
    fileWorkersRef      : IO.Ref FileWorkerMap
    /-- We store these to pass them to workers. -/
    initParams          : InitializeParams
    workerPath          : System.FilePath
    srcSearchPath       : System.SearchPath
    references          : IO.Ref References
    serverRequestData   : IO.Ref ServerRequestData
    importData          : IO.Ref ImportData
goal: List String

full_name: Lean.Server.Watchdog.ServerContext.hOut
code: structure ServerContext where
    hIn                 : FS.Stream
    hOut                : FS.Stream
    hLog                : FS.Stream
    /-- Command line arguments. -/
    args                : List String
    fileWorkersRef      : IO.Ref FileWorkerMap
    /-- We store these to pass them to workers. -/
    initParams          : InitializeParams
    workerPath          : System.FilePath
    srcSearchPath       : System.SearchPath
    references          : IO.Ref References
    serverRequestData   : IO.Ref ServerRequestData
    importData          : IO.Ref ImportData
goal: IO.FS.Stream

full_name: Lean.Server.Watchdog.ServerContext.importData
code: structure ServerContext where
    hIn                 : FS.Stream
    hOut                : FS.Stream
    hLog                : FS.Stream
    /-- Command line arguments. -/
    args                : List String
    fileWorkersRef      : IO.Ref FileWorkerMap
    /-- We store these to pass them to workers. -/
    initParams          : InitializeParams
    workerPath          : System.FilePath
    srcSearchPath       : System.SearchPath
    references          : IO.Ref References
    serverRequestData   : IO.Ref ServerRequestData
    importData          : IO.Ref ImportData
goal: IO.Ref Lean.Server.Watchdog.ImportData

full_name: Lean.Server.Watchdog.ServerContext.hLog
code: structure ServerContext where
    hIn                 : FS.Stream
    hOut                : FS.Stream
    hLog                : FS.Stream
    /-- Command line arguments. -/
    args                : List String
    fileWorkersRef      : IO.Ref FileWorkerMap
    /-- We store these to pass them to workers. -/
    initParams          : InitializeParams
    workerPath          : System.FilePath
    srcSearchPath       : System.SearchPath
    references          : IO.Ref References
    serverRequestData   : IO.Ref ServerRequestData
    importData          : IO.Ref ImportData
goal: IO.FS.Stream

full_name: Lean.Server.Watchdog.ServerContext.workerPath
code: structure ServerContext where
    hIn                 : FS.Stream
    hOut                : FS.Stream
    hLog                : FS.Stream
    /-- Command line arguments. -/
    args                : List String
    fileWorkersRef      : IO.Ref FileWorkerMap
    /-- We store these to pass them to workers. -/
    initParams          : InitializeParams
    workerPath          : System.FilePath
    srcSearchPath       : System.SearchPath
    references          : IO.Ref References
    serverRequestData   : IO.Ref ServerRequestData
    importData          : IO.Ref ImportData
goal: System.FilePath

full_name: Lean.Server.Watchdog.ServerContext.hIn
code: structure ServerContext where
    hIn                 : FS.Stream
    hOut                : FS.Stream
    hLog                : FS.Stream
    /-- Command line arguments. -/
    args                : List String
    fileWorkersRef      : IO.Ref FileWorkerMap
    /-- We store these to pass them to workers. -/
    initParams          : InitializeParams
    workerPath          : System.FilePath
    srcSearchPath       : System.SearchPath
    references          : IO.Ref References
    serverRequestData   : IO.Ref ServerRequestData
    importData          : IO.Ref ImportData
goal: IO.FS.Stream

full_name: Lean.Server.Watchdog.ServerContext.serverRequestData
code: structure ServerContext where
    hIn                 : FS.Stream
    hOut                : FS.Stream
    hLog                : FS.Stream
    /-- Command line arguments. -/
    args                : List String
    fileWorkersRef      : IO.Ref FileWorkerMap
    /-- We store these to pass them to workers. -/
    initParams          : InitializeParams
    workerPath          : System.FilePath
    srcSearchPath       : System.SearchPath
    references          : IO.Ref References
    serverRequestData   : IO.Ref ServerRequestData
    importData          : IO.Ref ImportData
goal: IO.Ref Lean.Server.Watchdog.ServerRequestData

full_name: Lean.Server.Watchdog.ServerContext
code: structure ServerContext where
    hIn                 : FS.Stream
    hOut                : FS.Stream
    hLog                : FS.Stream
    /-- Command line arguments. -/
    args                : List String
    fileWorkersRef      : IO.Ref FileWorkerMap
    /-- We store these to pass them to workers. -/
    initParams          : InitializeParams
    workerPath          : System.FilePath
    srcSearchPath       : System.SearchPath
    references          : IO.Ref References
    serverRequestData   : IO.Ref ServerRequestData
    importData          : IO.Ref ImportData
goal: Type

full_name: Lean.Server.Watchdog.ServerContext.srcSearchPath
code: structure ServerContext where
    hIn                 : FS.Stream
    hOut                : FS.Stream
    hLog                : FS.Stream
    /-- Command line arguments. -/
    args                : List String
    fileWorkersRef      : IO.Ref FileWorkerMap
    /-- We store these to pass them to workers. -/
    initParams          : InitializeParams
    workerPath          : System.FilePath
    srcSearchPath       : System.SearchPath
    references          : IO.Ref References
    serverRequestData   : IO.Ref ServerRequestData
    importData          : IO.Ref ImportData
goal: System.SearchPath

full_name: Lean.Server.Watchdog.ServerContext.initParams
code: structure ServerContext where
    hIn                 : FS.Stream
    hOut                : FS.Stream
    hLog                : FS.Stream
    /-- Command line arguments. -/
    args                : List String
    fileWorkersRef      : IO.Ref FileWorkerMap
    /-- We store these to pass them to workers. -/
    initParams          : InitializeParams
    workerPath          : System.FilePath
    srcSearchPath       : System.SearchPath
    references          : IO.Ref References
    serverRequestData   : IO.Ref ServerRequestData
    importData          : IO.Ref ImportData
goal: Lean.Lsp.InitializeParams

full_name: Lean.Server.Watchdog.ServerContext.fileWorkersRef
code: structure ServerContext where
    hIn                 : FS.Stream
    hOut                : FS.Stream
    hLog                : FS.Stream
    /-- Command line arguments. -/
    args                : List String
    fileWorkersRef      : IO.Ref FileWorkerMap
    /-- We store these to pass them to workers. -/
    initParams          : InitializeParams
    workerPath          : System.FilePath
    srcSearchPath       : System.SearchPath
    references          : IO.Ref References
    serverRequestData   : IO.Ref ServerRequestData
    importData          : IO.Ref ImportData
goal: IO.Ref Lean.Server.Watchdog.FileWorkerMap

full_name: Lean.Server.Watchdog.ServerContext.references
code: structure ServerContext where
    hIn                 : FS.Stream
    hOut                : FS.Stream
    hLog                : FS.Stream
    /-- Command line arguments. -/
    args                : List String
    fileWorkersRef      : IO.Ref FileWorkerMap
    /-- We store these to pass them to workers. -/
    initParams          : InitializeParams
    workerPath          : System.FilePath
    srcSearchPath       : System.SearchPath
    references          : IO.Ref References
    serverRequestData   : IO.Ref ServerRequestData
    importData          : IO.Ref ImportData
goal: IO.Ref Lean.Server.References

full_name: Lean.Server.Watchdog.ServerM
code: abbrev ServerM 
goal: Type

full_name: Lean.Server.Watchdog.updateFileWorkers
code: def updateFileWorkers (val : FileWorker) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.findFileWorker?
code: def findFileWorker? (uri : DocumentUri) : ServerM (Option FileWorker) 
goal: Lean.Server.Watchdog.ServerM (Option Lean.Server.Watchdog.FileWorker)

full_name: Lean.Server.Watchdog.eraseFileWorker
code: def eraseFileWorker (uri : DocumentUri) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.log
code: def log (msg : String) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.handleIleanInfoUpdate
code: def handleIleanInfoUpdate (fw : FileWorker) (params : LeanIleanInfoParams) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.handleIleanInfoFinal
code: def handleIleanInfoFinal (fw : FileWorker) (params : LeanIleanInfoParams) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.handleImportClosure
code: /--
  Updates the global import data with the import closure provided by the file worker after it
  successfully processed its header.
  -/
  def handleImportClosure (fw : FileWorker) (params : LeanImportClosureParams) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Server.Watchdog.0.Lean.Server.Watchdog.forwardMessages.loop
code: /-- Creates a Task which forwards a worker's messages into the output stream until an event
  which must be handled in the main watchdog thread (e.g. an I/O error) happens. -/
  private partial def forwardMessages (fw : FileWorker) : ServerM (Task WorkerEvent) 
goal: Lean.Server.Watchdog.ServerM Lean.Server.Watchdog.WorkerEvent

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Server.Watchdog.0.Lean.Server.Watchdog.forwardMessages
code: /-- Creates a Task which forwards a worker's messages into the output stream until an event
  which must be handled in the main watchdog thread (e.g. an I/O error) happens. -/
  private partial def forwardMessages (fw : FileWorker) : ServerM (Task WorkerEvent) 
goal: Lean.Server.Watchdog.ServerM (Task Lean.Server.Watchdog.WorkerEvent)

full_name: Lean.Server.Watchdog.startFileWorker
code: def startFileWorker (m : DocumentMeta) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.terminateFileWorker
code: def terminateFileWorker (uri : DocumentUri) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.handleCrash
code: def handleCrash (uri : DocumentUri) (queuedMsgs : Array JsonRpc.Message) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.tryWriteMessage
code: /-- Tries to write a message, sets the state of the FileWorker to `crashed` if it does not succeed
      and restarts the file worker if the `crashed` flag was already set. Just logs an error if
      there is no FileWorker at this `uri`.
      Messages that couldn't be sent can be queued up via the queueFailedMessage flag and
      will be discharged after the FileWorker is restarted. -/
  def tryWriteMessage
      (uri : DocumentUri)
      (msg : JsonRpc.Message)
      (queueFailedMessage := true)
      (restartCrashedWorker := false)
      : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.notifyAboutStaleDependency
code: /--
  Sends a notification to the file worker identified by `uri` that its dependency `staleDependency`
  is out-of-date.
  -/
  def notifyAboutStaleDependency (uri : DocumentUri) (staleDependency : DocumentUri)
      : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.findDefinitions
code: def findDefinitions (p : TextDocumentPositionParams) : ServerM <| Array Location 
goal: Lean.Server.Watchdog.ServerM (Array Lean.Lsp.Location)

full_name: Lean.Server.Watchdog.handleReference
code: def handleReference (p : ReferenceParams) : ServerM (Array Location) 
goal: Lean.Server.Watchdog.ServerM (Array Lean.Lsp.Location)

full_name: Lean.Server.Watchdog.CallHierarchyItemData.name
code: /--
Used in `CallHierarchyItem.data?` to retain all the data needed to quickly re-identify the
call hierarchy item.
-/
structure CallHierarchyItemData where
  module : Name
  name   : Name
  deriving FromJson, ToJson
goal: Lean.Name

full_name: Lean.Server.Watchdog.CallHierarchyItemData.module
code: /--
Used in `CallHierarchyItem.data?` to retain all the data needed to quickly re-identify the
call hierarchy item.
-/
structure CallHierarchyItemData where
  module : Name
  name   : Name
  deriving FromJson, ToJson
goal: Lean.Name

full_name: Lean.Server.Watchdog.CallHierarchyItemData
code: /--
Used in `CallHierarchyItem.data?` to retain all the data needed to quickly re-identify the
call hierarchy item.
-/
structure CallHierarchyItemData where
  module : Name
  name   : Name
  deriving FromJson, ToJson
goal: Type

full_name: Lean.Server.Watchdog.instFromJsonCallHierarchyItemData
code: FromJson
goal: Lean.FromJson Lean.Server.Watchdog.CallHierarchyItemData

full_name: Lean.Server.Watchdog.instToJsonCallHierarchyItemData
code: ToJson
goal: Lean.ToJson Lean.Server.Watchdog.CallHierarchyItemData

full_name: Lean.Server.Watchdog.CallHierarchyItemData.fromItem?
code: /--
Extracts the CallHierarchyItemData from `item.data?` and returns `none` if this is not possible.
-/
def CallHierarchyItemData.fromItem? (item : CallHierarchyItem) : Option CallHierarchyItemData 
goal: Option Lean.Server.Watchdog.CallHierarchyItemData

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Server.Watchdog.0.Lean.Server.Watchdog.callHierarchyItemOf?
code: private def callHierarchyItemOf?
    (refs          : References)
    (ident         : RefIdent)
    (srcSearchPath : SearchPath)
    : IO (Option CallHierarchyItem) 
goal: IO (Option Lean.Lsp.CallHierarchyItem)

full_name: Lean.Server.Watchdog.handlePrepareCallHierarchy
code: def handlePrepareCallHierarchy (p : CallHierarchyPrepareParams)
    : ServerM (Array CallHierarchyItem) 
goal: Lean.Server.Watchdog.ServerM (Array Lean.Lsp.CallHierarchyItem)

full_name: Lean.Server.Watchdog.handleCallHierarchyIncomingCalls
code: def handleCallHierarchyIncomingCalls (p : CallHierarchyIncomingCallsParams)
    : ServerM (Array CallHierarchyIncomingCall) 
goal: Lean.Server.Watchdog.ServerM (Array Lean.Lsp.CallHierarchyIncomingCall)

full_name: Lean.Server.Watchdog.handleCallHierarchyIncomingCalls.collapseSameIncomingCalls
code: def handleCallHierarchyIncomingCalls (p : CallHierarchyIncomingCallsParams)
    : ServerM (Array CallHierarchyIncomingCall) 
goal: Array Lean.Lsp.CallHierarchyIncomingCall

full_name: Lean.Server.Watchdog.handleCallHierarchyOutgoingCalls
code: def handleCallHierarchyOutgoingCalls (p : CallHierarchyOutgoingCallsParams)
    : ServerM (Array CallHierarchyOutgoingCall) 
goal: Lean.Server.Watchdog.ServerM (Array Lean.Lsp.CallHierarchyOutgoingCall)

full_name: Lean.Server.Watchdog.handleCallHierarchyOutgoingCalls.collapseSameOutgoingCalls
code: def handleCallHierarchyOutgoingCalls (p : CallHierarchyOutgoingCallsParams)
    : ServerM (Array CallHierarchyOutgoingCall) 
goal: Array Lean.Lsp.CallHierarchyOutgoingCall

full_name: Lean.Server.Watchdog.handleWorkspaceSymbol
code: def handleWorkspaceSymbol (p : WorkspaceSymbolParams) : ServerM (Array SymbolInformation) 
goal: Lean.Server.Watchdog.ServerM (Array Lean.Lsp.SymbolInformation)

full_name: Lean.Server.Watchdog.handlePrepareRename
code: def handlePrepareRename (p : PrepareRenameParams) : ServerM (Option Range) 
goal: Lean.Server.Watchdog.ServerM (Option Lean.Lsp.Range)

full_name: Lean.Server.Watchdog.handleRename
code: def handleRename (p : RenameParams) : ServerM Lsp.WorkspaceEdit 
goal: Lean.Server.Watchdog.ServerM Lean.Lsp.WorkspaceEdit

full_name: Lean.Server.Watchdog.handleDidOpen
code: def handleDidOpen (p : LeanDidOpenTextDocumentParams) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.handleDidChange
code: def handleDidChange (p : DidChangeTextDocumentParams) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.handleDidSave
code: /--
  When a file is saved, notifies all file workers for files that depend on this file that this
  specific import is now stale so that the file worker can issue a diagnostic asking users to
  restart the file.
  -/
  def handleDidSave (p : DidSaveTextDocumentParams) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.handleDidClose
code: def handleDidClose (p : DidCloseTextDocumentParams) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.handleDidChangeWatchedFiles
code: def handleDidChangeWatchedFiles (p : DidChangeWatchedFilesParams) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.handleCancelRequest
code: def handleCancelRequest (p : CancelParams) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.forwardNotification
code: def forwardNotification {α : Type} [ToJson α] [FileSource α] (method : String) (params : α)
      : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.parseParams
code: def parseParams (paramType : Type) [FromJson paramType] (params : Json) : ServerM paramType 
goal: Lean.Server.Watchdog.ServerM paramType

full_name: Lean.Server.Watchdog.forwardRequestToWorker
code: def forwardRequestToWorker (id : RequestID) (method : String) (params : Json) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.handleRequest
code: def handleRequest (id : RequestID) (method : String) (params : Json) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.handleNotification
code: def handleNotification (method : String) (params : Json) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.handleResponse
code: def handleResponse (id : RequestID) (result : Json) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.handleResponseError
code: def handleResponseError
      (id      : RequestID)
      (code    : ErrorCode)
      (message : String)
      (data?   : Option Json)
      : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.shutdown
code: def shutdown : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.ServerEvent.clientMsg
code: inductive ServerEvent where
    | workerEvent (fw : FileWorker) (ev : WorkerEvent)
    | clientMsg (msg : JsonRpc.Message)
    | clientError (e : IO.Error)
goal: Lean.Server.Watchdog.ServerEvent

full_name: Lean.Server.Watchdog.ServerEvent.clientError
code: inductive ServerEvent where
    | workerEvent (fw : FileWorker) (ev : WorkerEvent)
    | clientMsg (msg : JsonRpc.Message)
    | clientError (e : IO.Error)
goal: Lean.Server.Watchdog.ServerEvent

full_name: Lean.Server.Watchdog.ServerEvent
code: inductive ServerEvent where
    | workerEvent (fw : FileWorker) (ev : WorkerEvent)
    | clientMsg (msg : JsonRpc.Message)
    | clientError (e : IO.Error)
goal: Type

full_name: Lean.Server.Watchdog.ServerEvent.workerEvent
code: inductive ServerEvent where
    | workerEvent (fw : FileWorker) (ev : WorkerEvent)
    | clientMsg (msg : JsonRpc.Message)
    | clientError (e : IO.Error)
goal: Lean.Server.Watchdog.ServerEvent

full_name: Lean.Server.Watchdog.runClientTask
code: def runClientTask : ServerM (Task ServerEvent) 
goal: Lean.Server.Watchdog.ServerM (Task Lean.Server.Watchdog.ServerEvent)

full_name: Lean.Server.Watchdog.mainLoop
code: partial def mainLoop (clientTask : Task ServerEvent) : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.mkLeanServerCapabilities
code: def mkLeanServerCapabilities : ServerCapabilities 
goal: Lean.Lsp.ServerCapabilities

full_name: Lean.Server.Watchdog.initAndRunWatchdogAux
code: def initAndRunWatchdogAux : ServerM Unit 
goal: Lean.Server.Watchdog.ServerM Unit

full_name: Lean.Server.Watchdog.findWorkerPath
code: def findWorkerPath : IO System.FilePath 
goal: IO System.FilePath

full_name: Lean.Server.Watchdog.startLoadingReferences
code: /--
Starts loading .ileans present in the search path asynchronously in an IO task.
This ensures that server startup is not blocked by loading the .ileans.
In return, while the .ileans are being loaded, users will only get incomplete
results in requests that need references.
-/
def startLoadingReferences (references : IO.Ref References) : IO Unit 
goal: IO Unit

full_name: Lean.Server.Watchdog.initAndRunWatchdog
code: def initAndRunWatchdog (args : List String) (i o e : FS.Stream) : IO Unit 
goal: IO Unit

full_name: Lean.Server.Watchdog.watchdogMain
code: @[export lean_server_watchdog_main]
def watchdogMain (args : List String) : IO UInt32 
goal: IO UInt32