From ecd98fbb547cf1f00bd701eecc0462c4171dca59 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Wed, 11 Mar 2020 12:28:51 -0700 Subject: [PATCH] Don't warn user on Clear-Host --- .../PowerShellContext/EditorOperationsService.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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; } }