File: .lake/packages/lean4/src/lean/Lean/Server/FileWorker/RequestHandling.lean

full_name: Lean.Server.FileWorker.handleCompletion
code: def handleCompletion (p : CompletionParams)
    : RequestM (RequestTask CompletionList) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask Lean.Lsp.CompletionList)

full_name: Lean.Server.FileWorker.handleCompletionItemResolve
code: /--
Handles `completionItem/resolve` requests that are sent by the client after the user selects
a completion item that was provided by `textDocument/completion`. Resolving the item fills the
`detail?` field of the item with the pretty-printed type.
This control flow is necessary because pretty-printing the type for every single completion item
(even those never selected by the user) is inefficient.
-/
def handleCompletionItemResolve (item : CompletionItem)
    : RequestM (RequestTask CompletionItem) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask Lean.Lsp.CompletionItem)

full_name: Lean.Server.FileWorker.handleHover
code: def handleHover (p : HoverParams)
    : RequestM (RequestTask (Option Hover)) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask (Option Lean.Lsp.Hover))

full_name: Lean.Server.FileWorker.locationLinksOfInfo.extractInstances
code: def locationLinksOfInfo (kind : GoToKind) (ictx : InfoWithCtx)
    (infoTree? : Option InfoTree := none) : RequestM (Array LocationLink) 
goal: Lean.Expr → Lean.Server.RequestM (Array Lean.Name)

full_name: Lean.Server.FileWorker.locationLinksOfInfo
code: def locationLinksOfInfo (kind : GoToKind) (ictx : InfoWithCtx)
    (infoTree? : Option InfoTree := none) : RequestM (Array LocationLink) 
goal: Lean.Server.RequestM (Array Lean.Lsp.LocationLink)

full_name: Lean.Server.FileWorker.handleDefinition
code: def handleDefinition (kind : GoToKind) (p : TextDocumentPositionParams)
    : RequestM (RequestTask (Array LocationLink)) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask (Array Lean.Lsp.LocationLink))

full_name: Lean.Server.FileWorker.getInteractiveGoals
code: def getInteractiveGoals (p : Lsp.PlainGoalParams) : RequestM (RequestTask (Option Widget.InteractiveGoals)) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask (Option Lean.Widget.InteractiveGoals))

full_name: Lean.Server.FileWorker.handlePlainGoal
code: def handlePlainGoal (p : PlainGoalParams)
    : RequestM (RequestTask (Option PlainGoal)) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask (Option Lean.Lsp.PlainGoal))

full_name: Lean.Server.FileWorker.getInteractiveTermGoal
code: def getInteractiveTermGoal (p : Lsp.PlainTermGoalParams)
    : RequestM (RequestTask (Option Widget.InteractiveTermGoal)) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask (Option Lean.Widget.InteractiveTermGoal))

full_name: Lean.Server.FileWorker.handlePlainTermGoal
code: def handlePlainTermGoal (p : PlainTermGoalParams)
    : RequestM (RequestTask (Option PlainTermGoal)) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask (Option Lean.Lsp.PlainTermGoal))

full_name: Lean.Server.FileWorker.handleDocumentHighlight
code: partial def handleDocumentHighlight (p : DocumentHighlightParams)
    : RequestM (RequestTask (Array DocumentHighlight)) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask (Array Lean.Lsp.DocumentHighlight))

full_name: Lean.Server.FileWorker.handleDocumentHighlight.highlightReturn?
code: partial def handleDocumentHighlight (p : DocumentHighlightParams)
    : RequestM (RequestTask (Array DocumentHighlight)) 
goal: Lean.Syntax → Option Lean.Lsp.DocumentHighlight

full_name: Lean.Server.FileWorker.NamespaceEntry.name
code: structure NamespaceEntry where
  /-- The list of the name components introduced by this namespace command,
  in reverse order so that `end` will peel them off from the front. -/
  name : List Name
  stx : Syntax
  selection : Syntax
  prevSiblings : Array DocumentSymbol
goal: List Lean.Name

full_name: Lean.Server.FileWorker.NamespaceEntry.prevSiblings
code: structure NamespaceEntry where
  /-- The list of the name components introduced by this namespace command,
  in reverse order so that `end` will peel them off from the front. -/
  name : List Name
  stx : Syntax
  selection : Syntax
  prevSiblings : Array DocumentSymbol
goal: Array Lean.Lsp.DocumentSymbol

full_name: Lean.Server.FileWorker.NamespaceEntry
code: structure NamespaceEntry where
  /-- The list of the name components introduced by this namespace command,
  in reverse order so that `end` will peel them off from the front. -/
  name : List Name
  stx : Syntax
  selection : Syntax
  prevSiblings : Array DocumentSymbol
goal: Type

full_name: Lean.Server.FileWorker.NamespaceEntry.selection
code: structure NamespaceEntry where
  /-- The list of the name components introduced by this namespace command,
  in reverse order so that `end` will peel them off from the front. -/
  name : List Name
  stx : Syntax
  selection : Syntax
  prevSiblings : Array DocumentSymbol
goal: Lean.Syntax

full_name: Lean.Server.FileWorker.NamespaceEntry.stx
code: structure NamespaceEntry where
  /-- The list of the name components introduced by this namespace command,
  in reverse order so that `end` will peel them off from the front. -/
  name : List Name
  stx : Syntax
  selection : Syntax
  prevSiblings : Array DocumentSymbol
goal: Lean.Syntax

full_name: Lean.Server.FileWorker.NamespaceEntry.finish
code: def NamespaceEntry.finish (text : FileMap) (syms : Array DocumentSymbol) (endStx : Option Syntax) :
    NamespaceEntry → Array DocumentSymbol
  
goal: Lean.Server.FileWorker.NamespaceEntry → Array Lean.Lsp.DocumentSymbol

full_name: Lean.Server.FileWorker.handleDocumentSymbol.toDocumentSymbols
code: partial def handleDocumentSymbol (_ : DocumentSymbolParams)
    : RequestM (RequestTask DocumentSymbolResult) 
goal: Array Lean.Lsp.DocumentSymbol

full_name: Lean.Server.FileWorker.handleDocumentSymbol
code: partial def handleDocumentSymbol (_ : DocumentSymbolParams)
    : RequestM (RequestTask DocumentSymbolResult) 
goal: Lean.Lsp.DocumentSymbolParams → Lean.Server.RequestM (Lean.Server.RequestTask Lean.Lsp.DocumentSymbolResult)

full_name: Lean.Server.FileWorker.handleDocumentSymbol.toDocumentSymbols.popStack
code: partial def handleDocumentSymbol (_ : DocumentSymbolParams)
    : RequestM (RequestTask DocumentSymbolResult) 
goal: List Lean.Server.FileWorker.NamespaceEntry → Array Lean.Lsp.DocumentSymbol

full_name: Lean.Server.FileWorker.noHighlightKinds
code: /--
`SyntaxNodeKind`s for which the syntax node and its children receive no semantic highlighting.
-/
def noHighlightKinds : Array SyntaxNodeKind 
goal: Array Lean.SyntaxNodeKind

full_name: Lean.Server.FileWorker.keywordSemanticTokenMap
code: /-- Keywords for which a specific semantic token is provided. -/
def keywordSemanticTokenMap : RBMap String SemanticTokenType compare 
goal: Lean.RBMap String Lean.Lsp.SemanticTokenType compare

full_name: Lean.Server.FileWorker.LeanSemanticToken
code: /-- Semantic token information for a given `Syntax`. -/
structure LeanSemanticToken where
  /-- Syntax of the semantic token. -/
  stx  : Syntax
  /-- Type of the semantic token. -/
  type : SemanticTokenType
goal: Type

full_name: Lean.Server.FileWorker.LeanSemanticToken.type
code: /-- Semantic token information for a given `Syntax`. -/
structure LeanSemanticToken where
  /-- Syntax of the semantic token. -/
  stx  : Syntax
  /-- Type of the semantic token. -/
  type : SemanticTokenType
goal: Lean.Lsp.SemanticTokenType

full_name: Lean.Server.FileWorker.LeanSemanticToken.stx
code: /-- Semantic token information for a given `Syntax`. -/
structure LeanSemanticToken where
  /-- Syntax of the semantic token. -/
  stx  : Syntax
  /-- Type of the semantic token. -/
  type : SemanticTokenType
goal: Lean.Syntax

full_name: Lean.Server.FileWorker.instBEqAbsoluteLspSemanticToken
code: /-- Semantic token information with absolute LSP positions. -/
structure AbsoluteLspSemanticToken where
  /-- Start position of the semantic token. -/
  pos     : Lsp.Position
  /-- End position of the semantic token. -/
  tailPos : Lsp.Position
  /-- Start position of the semantic token. -/
  type    : SemanticTokenType
  deriving BEq, Hashable, FromJson, ToJson
goal: BEq Lean.Server.FileWorker.AbsoluteLspSemanticToken

full_name: Lean.Server.FileWorker.AbsoluteLspSemanticToken.pos
code: /-- Semantic token information with absolute LSP positions. -/
structure AbsoluteLspSemanticToken where
  /-- Start position of the semantic token. -/
  pos     : Lsp.Position
  /-- End position of the semantic token. -/
  tailPos : Lsp.Position
  /-- Start position of the semantic token. -/
  type    : SemanticTokenType
  deriving BEq, Hashable, FromJson, ToJson
goal: Lean.Lsp.Position

full_name: Lean.Server.FileWorker.AbsoluteLspSemanticToken.type
code: /-- Semantic token information with absolute LSP positions. -/
structure AbsoluteLspSemanticToken where
  /-- Start position of the semantic token. -/
  pos     : Lsp.Position
  /-- End position of the semantic token. -/
  tailPos : Lsp.Position
  /-- Start position of the semantic token. -/
  type    : SemanticTokenType
  deriving BEq, Hashable, FromJson, ToJson
goal: Lean.Lsp.SemanticTokenType

full_name: Lean.Server.FileWorker.AbsoluteLspSemanticToken
code: /-- Semantic token information with absolute LSP positions. -/
structure AbsoluteLspSemanticToken where
  /-- Start position of the semantic token. -/
  pos     : Lsp.Position
  /-- End position of the semantic token. -/
  tailPos : Lsp.Position
  /-- Start position of the semantic token. -/
  type    : SemanticTokenType
  deriving BEq, Hashable, FromJson, ToJson
goal: Type

full_name: Lean.Server.FileWorker.AbsoluteLspSemanticToken.tailPos
code: /-- Semantic token information with absolute LSP positions. -/
structure AbsoluteLspSemanticToken where
  /-- Start position of the semantic token. -/
  pos     : Lsp.Position
  /-- End position of the semantic token. -/
  tailPos : Lsp.Position
  /-- Start position of the semantic token. -/
  type    : SemanticTokenType
  deriving BEq, Hashable, FromJson, ToJson
goal: Lean.Lsp.Position

full_name: Lean.Server.FileWorker.instHashableAbsoluteLspSemanticToken
code: /-- Semantic token information with absolute LSP positions. -/
structure AbsoluteLspSemanticToken where
  /-- Start position of the semantic token. -/
  pos     : Lsp.Position
  /-- End position of the semantic token. -/
  tailPos : Lsp.Position
  /-- Start position of the semantic token. -/
  type    : SemanticTokenType
  deriving BEq, Hashable, FromJson, ToJson
goal: Hashable Lean.Server.FileWorker.AbsoluteLspSemanticToken

full_name: Lean.Server.FileWorker.instFromJsonAbsoluteLspSemanticToken
code: FromJson
goal: Lean.FromJson Lean.Server.FileWorker.AbsoluteLspSemanticToken

full_name: Lean.Server.FileWorker.instToJsonAbsoluteLspSemanticToken
code: ToJson
goal: Lean.ToJson Lean.Server.FileWorker.AbsoluteLspSemanticToken

full_name: Lean.Server.FileWorker.computeAbsoluteLspSemanticTokens
code: /--
Given a set of `LeanSemanticToken`, computes the `AbsoluteLspSemanticToken` with absolute
LSP position information for each token.
-/
def computeAbsoluteLspSemanticTokens
    (text     : FileMap)
    (beginPos : String.Pos)
    (endPos?  : Option String.Pos)
    (tokens   : Array LeanSemanticToken)
    : Array AbsoluteLspSemanticToken 
goal: Array Lean.Server.FileWorker.AbsoluteLspSemanticToken

full_name: Lean.Server.FileWorker.filterDuplicateSemanticTokens
code: /-- Filters all duplicate semantic tokens with the same `pos`, `tailPos` and `type`. -/
def filterDuplicateSemanticTokens (tokens : Array AbsoluteLspSemanticToken) : Array AbsoluteLspSemanticToken 
goal: Array Lean.Server.FileWorker.AbsoluteLspSemanticToken

full_name: Lean.Server.FileWorker.computeDeltaLspSemanticTokens
code: /--
Given a set of `AbsoluteLspSemanticToken`, computes the LSP `SemanticTokens` data with
token-relative positioning.
See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_semanticTokens.
-/
def computeDeltaLspSemanticTokens (tokens : Array AbsoluteLspSemanticToken) : SemanticTokens 
goal: Lean.Lsp.SemanticTokens

full_name: Lean.Server.FileWorker.collectSyntaxBasedSemanticTokens
code: /--
Collects all semantic tokens that can be deduced purely from `Syntax`
without elaboration information.
-/
partial def collectSyntaxBasedSemanticTokens : (stx : Syntax) → Array LeanSemanticToken
  
goal: Array Lean.Server.FileWorker.LeanSemanticToken

full_name: Lean.Server.FileWorker.collectInfoBasedSemanticTokens
code: /-- Collects all semantic tokens from the given `Elab.InfoTree`. -/
def collectInfoBasedSemanticTokens (i : Elab.InfoTree) : Array LeanSemanticToken 
goal: Array Lean.Server.FileWorker.LeanSemanticToken

full_name: Lean.Server.FileWorker.handleSemanticTokens.run
code: /-- Computes the semantic tokens in the range [beginPos, endPos?). -/
def handleSemanticTokens (beginPos : String.Pos) (endPos? : Option String.Pos)
    : RequestM (RequestTask SemanticTokens) 
goal: Lean.Server.RequestM Lean.Lsp.SemanticTokens

full_name: Lean.Server.FileWorker.handleSemanticTokens
code: /-- Computes the semantic tokens in the range [beginPos, endPos?). -/
def handleSemanticTokens (beginPos : String.Pos) (endPos? : Option String.Pos)
    : RequestM (RequestTask SemanticTokens) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask Lean.Lsp.SemanticTokens)

full_name: Lean.Server.FileWorker.handleSemanticTokensFull
code: /-- Computes all semantic tokens for the document. -/
def handleSemanticTokensFull (_ : SemanticTokensParams)
    : RequestM (RequestTask SemanticTokens) 
goal: Lean.Lsp.SemanticTokensParams → Lean.Server.RequestM (Lean.Server.RequestTask Lean.Lsp.SemanticTokens)

full_name: Lean.Server.FileWorker.handleSemanticTokensRange
code: /-- Computes the semantic tokens in the range provided by `p`. -/
def handleSemanticTokensRange (p : SemanticTokensRangeParams)
    : RequestM (RequestTask SemanticTokens) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask Lean.Lsp.SemanticTokens)

full_name: Lean.Server.FileWorker.handleFoldingRange.addRanges
code: partial def handleFoldingRange (_ : FoldingRangeParams)
  : RequestM (RequestTask (Array FoldingRange)) 
goal: List Lean.Syntax → StateT (Array Lean.Lsp.FoldingRange) Lean.Server.RequestM PUnit

full_name: Lean.Server.FileWorker.handleFoldingRange.addRanges.popRanges
code: partial def handleFoldingRange (_ : FoldingRangeParams)
  : RequestM (RequestTask (Array FoldingRange)) 
goal: StateT (Array Lean.Lsp.FoldingRange) Lean.Server.RequestM PUnit

full_name: Lean.Server.FileWorker.handleFoldingRange.addRange
code: partial def handleFoldingRange (_ : FoldingRangeParams)
  : RequestM (RequestTask (Array FoldingRange)) 
goal: StateT (Array Lean.Lsp.FoldingRange) Lean.Server.RequestM PUnit

full_name: Lean.Server.FileWorker.handleFoldingRange
code: partial def handleFoldingRange (_ : FoldingRangeParams)
  : RequestM (RequestTask (Array FoldingRange)) 
goal: Lean.Lsp.FoldingRangeParams → Lean.Server.RequestM (Lean.Server.RequestTask (Array Lean.Lsp.FoldingRange))

full_name: Lean.Server.FileWorker.handleFoldingRange.isImport
code: partial def handleFoldingRange (_ : FoldingRangeParams)
  : RequestM (RequestTask (Array FoldingRange)) 
goal: Bool

full_name: Lean.Server.FileWorker.handleFoldingRange.addCommandRange
code: partial def handleFoldingRange (_ : FoldingRangeParams)
  : RequestM (RequestTask (Array FoldingRange)) 
goal: StateT (Array Lean.Lsp.FoldingRange) Lean.Server.RequestM PUnit

full_name: Lean.Server.FileWorker.handleFoldingRange.addRangeFromSyntax
code: partial def handleFoldingRange (_ : FoldingRangeParams)
  : RequestM (RequestTask (Array FoldingRange)) 
goal: StateT (Array Lean.Lsp.FoldingRange) Lean.Server.RequestM PUnit

full_name: Lean.Server.FileWorker.handleWaitForDiagnostics
code: partial def handleWaitForDiagnostics (p : WaitForDiagnosticsParams)
    : RequestM (RequestTask WaitForDiagnostics) 
goal: Lean.Server.RequestM (Lean.Server.RequestTask Lean.Lsp.WaitForDiagnostics)

full_name: Lean.Server.FileWorker.handleWaitForDiagnostics.waitLoop
code: partial def handleWaitForDiagnostics (p : WaitForDiagnosticsParams)
    : RequestM (RequestTask WaitForDiagnostics) 
goal: Lean.Server.RequestM Lean.Server.FileWorker.EditableDocument

full_name: Lean.Server.FileWorker.initFn._@..lake.packages.lean4.src.lean.Lean.Server.FileWorker.RequestHandling._hyg.12639
code: builtin_initialize
  registerLspRequestHandler
    "textDocument/waitForDiagnostics"
    WaitForDiagnosticsParams
    WaitForDiagnostics
    handleWaitForDiagnostics
  registerLspRequestHandler
    "textDocument/completion"
    CompletionParams
    CompletionList
    handleCompletion
  registerLspRequestHandler
    "completionItem/resolve"
    CompletionItem
    CompletionItem
    handleCompletionItemResolve
  registerLspRequestHandler
    "textDocument/hover"
    HoverParams
    (Option Hover)
    handleHover
  registerLspRequestHandler
    "textDocument/declaration"
    TextDocumentPositionParams
    (Array LocationLink)
    (handleDefinition GoToKind.declaration)
  registerLspRequestHandler
    "textDocument/definition"
    TextDocumentPositionParams
    (Array LocationLink)
    (handleDefinition GoToKind.definition)
  registerLspRequestHandler
    "textDocument/typeDefinition"
    TextDocumentPositionParams
    (Array LocationLink)
    (handleDefinition GoToKind.type)
  registerLspRequestHandler
    "textDocument/documentHighlight"
    DocumentHighlightParams
    DocumentHighlightResult
    handleDocumentHighlight
  registerLspRequestHandler
    "textDocument/documentSymbol"
    DocumentSymbolParams
    DocumentSymbolResult
    handleDocumentSymbol
  registerLspRequestHandler
    "textDocument/semanticTokens/full"
    SemanticTokensParams
    SemanticTokens
    handleSemanticTokensFull
  registerLspRequestHandler
    "textDocument/semanticTokens/range"
    SemanticTokensRangeParams
    SemanticTokens
    handleSemanticTokensRange
  registerLspRequestHandler
    "textDocument/foldingRange"
    FoldingRangeParams
    (Array FoldingRange)
    handleFoldingRange
  registerLspRequestHandler
    "$/lean/plainGoal"
    PlainGoalParams
    (Option PlainGoal)
    handlePlainGoal
  registerLspRequestHandler
    "$/lean/plainTermGoal"
    PlainTermGoalParams
    (Option PlainTermGoal)
    handlePlainTermGoal
goal: IO Unit