From 9ce8911e21c4822d64bc54838d30bdc77e3c682b Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Thu, 14 Nov 2024 22:17:39 -0800 Subject: [PATCH] Fix bug with Info getting extra logs on the vscode LSP client side --- .../Logging/LanguageServerLogger.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/PowerShellEditorServices/Logging/LanguageServerLogger.cs b/src/PowerShellEditorServices/Logging/LanguageServerLogger.cs index e9d9a06e2..0b22ddd95 100644 --- a/src/PowerShellEditorServices/Logging/LanguageServerLogger.cs +++ b/src/PowerShellEditorServices/Logging/LanguageServerLogger.cs @@ -68,7 +68,7 @@ public void Log( { messagePrepend = logLevel switch { - LogLevel.Critical => " CRITICAL: ", + LogLevel.Critical => "CRITICAL: ", LogLevel.Error => "", LogLevel.Warning => "", LogLevel.Information => "", @@ -76,6 +76,12 @@ public void Log( LogLevel.Trace => "", _ => string.Empty }; + + // The vscode formatter prepends some extra stuff to Info specifically, so we drop Info to Log, but it will get logged correctly on the other side thanks to our inline indicator that our custom parser on the other side will pick up and process. + if (messageType == MessageType.Info) + { + messageType = MessageType.Log; + } } LogMessageParams logMessage = new()