Skip to content

Commit a5c4e8e

Browse files
authored
Prevent console output interference with LSP communication (#1446)
1 parent f3b9189 commit a5c4e8e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3458,6 +3458,11 @@ module AdaptiveFSharpLspServer =
34583458
use input = Console.OpenStandardInput()
34593459
use output = Console.OpenStandardOutput()
34603460

3461+
// Attempt to prevent any console output from interfering with the LSP communication from libraries that may use Console.WriteLine
3462+
// https://github.com/ionide/ionide-vscode-fsharp/issues/2102
3463+
// This is a best-effort mitigation; libraries that write directly to the underlying stream like (Console.OpenStandardOutput) may still interfere.
3464+
Console.SetOut(TextWriter.Null)
3465+
34613466
let requestsHandlings =
34623467
(defaultRequestHandlings (): Map<string, ServerRequestHandling<IFSharpLspServer>>)
34633468
|> Map.add "fsharp/signature" (serverRequestHandling (fun s p -> s.FSharpSignature(p)))

0 commit comments

Comments
 (0)