From cfd802738326249ade91b9357a9fa23cd192c897 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Wed, 4 Feb 2026 11:38:35 -0500 Subject: [PATCH] Prevent console output interference with LSP communication --- src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs index 80e0a7317..4039c350f 100644 --- a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs +++ b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs @@ -3458,6 +3458,11 @@ module AdaptiveFSharpLspServer = use input = Console.OpenStandardInput() use output = Console.OpenStandardOutput() + // Attempt to prevent any console output from interfering with the LSP communication from libraries that may use Console.WriteLine + // https://github.com/ionide/ionide-vscode-fsharp/issues/2102 + // This is a best-effort mitigation; libraries that write directly to the underlying stream like (Console.OpenStandardOutput) may still interfere. + Console.SetOut(TextWriter.Null) + let requestsHandlings = (defaultRequestHandlings (): Map>) |> Map.add "fsharp/signature" (serverRequestHandling (fun s p -> s.FSharpSignature(p)))