Skip to content

Commit

Permalink
Restore textDocument/documentSymbol handler
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Tao <[email protected]>
  • Loading branch information
razzmatazz and tcx4c70 committed Feb 24, 2024
1 parent 1328fa9 commit 36bcc29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/CSharpLanguageServer/Handlers/DocumentSymbol.fs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ module DocumentSymbol =
let provider (clientCapabilities: ClientCapabilities option) : U2<bool,DocumentSymbolOptions> option =
true |> U2.First |> Some

let handle (scope: ServerRequestScope) (p: DocumentSymbolParams): AsyncLspResult<DocumentSymbol [] option> = async {
let handle (scope: ServerRequestScope)
(p: DocumentSymbolParams)
: AsyncLspResult<U2<SymbolInformation [], DocumentSymbol []> option> = async {
let canEmitDocSymbolHierarchy =
scope.ClientCapabilities
|> Option.bind (fun cc -> cc.TextDocument)
Expand All @@ -35,6 +37,7 @@ module DocumentSymbol =
collector.Visit(syntaxTree.GetRoot())

return collector.GetDocumentSymbols(canEmitDocSymbolHierarchy)
|> U2.Second
|> Some
|> LspResult.success

Expand Down
3 changes: 2 additions & 1 deletion src/CSharpLanguageServer/Lsp/Server.fs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ type CSharpLspServer(lspClient: CSharpLspClient, settings: ServerSettings) =
override this.TextDocumentOnTypeFormatting(p) =
p |> withReadOnlyScope DocumentOnTypeFormatting.handle

override this.TextDocumentDocumentSymbol(p) = notImplemented
override this.TextDocumentDocumentSymbol(p) =
p |> withReadOnlyScope DocumentSymbol.handle

override __.WorkspaceDidChangeWatchedFiles(p) =
p |> withReadWriteScope (Workspace.didChangeWatchedFiles logMessage diagnostics.Post)
Expand Down

0 comments on commit 36bcc29

Please sign in to comment.