From 36bcc2959f0d1e5283c02b7c939f226e5c12f901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saulius=20Menkevi=C4=8Dius?= Date: Sat, 24 Feb 2024 15:39:06 +0200 Subject: [PATCH] Restore textDocument/documentSymbol handler Co-authored-by: Adam Tao --- src/CSharpLanguageServer/Handlers/DocumentSymbol.fs | 5 ++++- src/CSharpLanguageServer/Lsp/Server.fs | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/CSharpLanguageServer/Handlers/DocumentSymbol.fs b/src/CSharpLanguageServer/Handlers/DocumentSymbol.fs index cf8a9fff..092964c2 100644 --- a/src/CSharpLanguageServer/Handlers/DocumentSymbol.fs +++ b/src/CSharpLanguageServer/Handlers/DocumentSymbol.fs @@ -14,7 +14,9 @@ module DocumentSymbol = let provider (clientCapabilities: ClientCapabilities option) : U2 option = true |> U2.First |> Some - let handle (scope: ServerRequestScope) (p: DocumentSymbolParams): AsyncLspResult = async { + let handle (scope: ServerRequestScope) + (p: DocumentSymbolParams) + : AsyncLspResult option> = async { let canEmitDocSymbolHierarchy = scope.ClientCapabilities |> Option.bind (fun cc -> cc.TextDocument) @@ -35,6 +37,7 @@ module DocumentSymbol = collector.Visit(syntaxTree.GetRoot()) return collector.GetDocumentSymbols(canEmitDocSymbolHierarchy) + |> U2.Second |> Some |> LspResult.success diff --git a/src/CSharpLanguageServer/Lsp/Server.fs b/src/CSharpLanguageServer/Lsp/Server.fs index 4a2ae324..12e048c1 100644 --- a/src/CSharpLanguageServer/Lsp/Server.fs +++ b/src/CSharpLanguageServer/Lsp/Server.fs @@ -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)