-
Notifications
You must be signed in to change notification settings - Fork 359
Interactive Window (REPL)
🎵Note: This documentation is outdated at this point, especially when using the Node tools in Visual Studio 2017. We're working on update docs, and will redirect you to those when they're ready.
Node.js Tools for Visual Studio includes an interactive window for your installed Node.js interpreter. Also known as a REPL (Read/Evaluate/Print Loop) window, this allows you to enter Node.js code and see the results immediately. You can use all built-in modules, syntax and variables, just like in a Node.js script.
The easiest way is to type CTRL + K, followed by N.
That's the shortcut assigned to the command for View/Other Windows/Node.js Interactive Window:
Alternatively you can right-click on the project node and select the Interactive Window:
You can use the up/down arrow keys to recall previous commands.
You can also navigate in the code to change a function.
And then re-execute:
The interactive window has several built-in commands, which start with the dot prefix.
Shows a list of REPL commands.
Resets the context object to an empty object and clears any multi-line expression.
Clears the contents of the REPL editor window.
Suppress or unsuppress output to the buffer.
Use echo on
to enable, echo off
to disable and echo
without parameters to display the current state. Use echo <text>
to echo the text passed in.
Executes npm command. If solution contains multiple projects, specify target project using .npm [ProjectName] <npm arguments>
This is covered in more detail in the npm section of the documentation.
Reset to an empty execution engine, but keep REPL history.
Save the current REPL session to a file.
Wait for at least the specified number of milliseconds.
- There is no way to abort a command that is currently executing.
-
require()
does not work against custom modules.