Skip to content

Commit 47d4563

Browse files
Don't warn user on Clear-Host (#1229)
1 parent 487454a commit 47d4563

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/PowerShellEditorServices/Services/PowerShellContext/EditorOperationsService.cs

+8-4
Original file line numberDiff line numberDiff line change
@@ -244,23 +244,27 @@ public async Task SetStatusBarMessageAsync(string message, int? timeout)
244244

245245
public void ClearTerminal()
246246
{
247-
if (!TestHasLanguageServer())
247+
if (!TestHasLanguageServer(warnUser: false))
248248
{
249249
return;
250250
};
251251

252252
_languageServer.SendNotification("editor/clearTerminal");
253253
}
254254

255-
private bool TestHasLanguageServer()
255+
private bool TestHasLanguageServer(bool warnUser = true)
256256
{
257257
if (_languageServer != null)
258258
{
259259
return true;
260260
}
261261

262-
_powerShellContextService.ExternalHost.UI.WriteWarningLine(
263-
"Editor operations are not supported in temporary consoles. Re-run the command in the main PowerShell Intergrated Console.");
262+
if (warnUser)
263+
{
264+
_powerShellContextService.ExternalHost.UI.WriteWarningLine(
265+
"Editor operations are not supported in temporary consoles. Re-run the command in the main PowerShell Intergrated Console.");
266+
}
267+
264268
return false;
265269
}
266270
}

0 commit comments

Comments
 (0)