Reputation: 57
While watching the YouTube development video, I used the command (code . -r
) in the cmd window in vscode. What is this function? vscode turned on, but what does -r
mean?
Upvotes: 1
Views: 1251
Reputation: 7819
From the official documentation:
-r or --reuse-window Forces opening a file or folder in the last active window.
IE, it doesn't launches a new instance of VSC, but opens a new tab in the existing opened instance, if it exists.
Upvotes: 1
Reputation: 8417
The help says:
-r --reuse-window Force to open a file or folder in an already opened window.
Full help is available to you:
$ code -h
code 1.55.2
Usage: code [options][paths...]
To read from stdin, append '-' (e.g. 'ps aux | grep code | code -')
Options
-d --diff <file> <file> Compare two files with each other.
-a --add <folder> Add folder(s) to the last active window.
-g --goto <file:line[:character]> Open a file at the path on the specified line and character position.
-n --new-window Force to open a new window.
-r --reuse-window Force to open a file or folder in an already opened window.
-w --wait Wait for the files to be closed before returning.
--locale <locale> The locale to use (e.g. en-US or zh-TW).
-h --help Print usage.
Extensions Management
--list-extensions List the installed extensions.
--show-versions Show versions of installed extensions, when using
--list-extensions.
--category Filters installed extensions by provided category, when
using --list-extensions.
--install-extension <extension-id[@version] | path-to-vsix> Installs or updates the extension. The identifier of an
extension is always `${publisher}.${name}`. Use
`--force` argument to update to latest version. To
install a specific version provide `@${version}`. For
example: '[email protected]'.
--uninstall-extension <extension-id> Uninstalls an extension.
--enable-proposed-api <extension-id> Enables proposed API features for extensions. Can receive
one or more extension IDs to enable individually.
Troubleshooting
-v --version Print version.
--verbose Print verbose output (implies --wait).
--log <level> Log level to use. Default is 'info'. Allowed values are 'critical', 'error',
'warn', 'info', 'debug', 'trace', 'off'.
-s --status Print process usage and diagnostics information.
--prof-startup Run CPU profiler during startup
--disable-extensions Disable all installed extensions.
--disable-extension <extension-id> Disable an extension.
--sync <on> <off> Turn sync on or off
--inspect-extensions <port> Allow debugging and profiling of extensions. Check the developer tools for the
connection URI.
--inspect-brk-extensions <port> Allow debugging and profiling of extensions with the extension host being paused
after start. Check the developer tools for the connection URI.
--disable-gpu Disable GPU hardware acceleration.
--max-memory Max memory size for a window (in Mbytes).
Upvotes: 1