diff --git a/src/PowerShellEditorServices/Services/PowerShellContext/EditorOperationsService.cs b/src/PowerShellEditorServices/Services/PowerShellContext/EditorOperationsService.cs index b489e7b1e..7b787d736 100644 --- a/src/PowerShellEditorServices/Services/PowerShellContext/EditorOperationsService.cs +++ b/src/PowerShellEditorServices/Services/PowerShellContext/EditorOperationsService.cs @@ -244,7 +244,7 @@ public async Task SetStatusBarMessageAsync(string message, int? timeout) public void ClearTerminal() { - if (!TestHasLanguageServer()) + if (!TestHasLanguageServer(warnUser: false)) { return; }; @@ -252,15 +252,19 @@ public void ClearTerminal() _languageServer.SendNotification("editor/clearTerminal"); } - private bool TestHasLanguageServer() + private bool TestHasLanguageServer(bool warnUser = true) { if (_languageServer != null) { return true; } - _powerShellContextService.ExternalHost.UI.WriteWarningLine( - "Editor operations are not supported in temporary consoles. Re-run the command in the main PowerShell Intergrated Console."); + if (warnUser) + { + _powerShellContextService.ExternalHost.UI.WriteWarningLine( + "Editor operations are not supported in temporary consoles. Re-run the command in the main PowerShell Intergrated Console."); + } + return false; } }