Is there a command to clear the immediate window in Visual Studio?
I hate having to grab the mouse for a right click menu there - would rather just type "cls" or something.
There is no Immediate Window unlike Visual Studio in VSCode. But you can still execute Javascript in VSCode. Open the JavaScript file in VSCode, then use shortcut Ctrl + Alt + N , the code will run and the output will be shown in the Output Window.
The differences between the Command and Immediate windowsThe Command window can load dlls or packages into the IDE as well. The Immediate window, on the other hand, is solely used during debugging and is useful to execute statements, print values of a contextual variable, or even evaluate expressions.
Print is used to show the value of a variable instantly in the immediate window.
The Command window is used to execute commands or aliases directly in the Visual Studio integrated development environment (IDE). You can execute both menu commands and commands that do not appear on any menu. To display the Command window, choose Other Windows from the View menu, and select Command Window.
To clear the immediate window, you can use >cls
, which is a predefined command alias to >Edit.ClearAll
.
The MSDN article lists all predefined aliases and you can define your own, too. (For VS 2010 and earlier, custom aliases are described in a separate article, though.) Scanning through, there's a whole slew of them, some of which might even have their roots in MS-DOS DEBUG.EXE (specifically >d
, >g
, >p
, >q
, and >t
come to mind).
Also worth noting as it's only two keys to press: Context menu > Clear All invokes the same command and it can be navigated using keyboard. Therefore in the immediate window, you can press Context Menu, L.
If you don't have a context-menu
key on your keyboard (you know, the one between Right Alt and Right Ctrl), you can use Shift+F10 instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With