You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Command line argument documentation and a '--help' option #6484
Visual Studio Code seems to accept command line arguments for some things, such as disabling extentions and openning to a given path, however they do not seem to be documented anywhere (that I can easily find at least). I'm sure many other users have run into the problem of wanting to know what vscode supports when opened from a terminal and the first thing most of them will try is passing the --help option to vscode.
So, my feature request is for a standard help/usage message to be displayed when giving the --help option to vscode.
Visual Studio Code v1.1.0
Usage: code [arguments] [paths...]
Options:
-d, --diff Open a diff editor. Requires to pass two file paths
as arguments.
--disable-extensions Disable all installed extensions.
-g, --goto Open the file at path at the line and column (add
:line[:column] to path).
-h, --help Print usage.
--locale <locale> The locale to use (e.g. en-US or zh-TW).
-n, --new-window Force a new instance of Code.
-r, --reuse-window Force opening a file or folder in the last active
window.
--user-data-dir <dir> Specifies the directory that user data is kept in,
useful when running as root.
-v, --version Print version.
-w, --wait Wait for the window to be closed before returning.
--list-extensions List the installed extensions.
--install-extension <extension>
Installs an extension.
--uninstall-extension <extension>
Uninstalls an extension.
Can you provide OS and if on Linux/OSX run whereis code and provide the output?
I'm using Arch Linux x86_64 using the AUR package for visual-studio-code. The output of whereis visual-studio-code (which is the name it was installed as) gives: visual-studio-code: /usr/bin/visual-studio-code
EDIT: whereis code gives code: /opt/visual-studio-code/bin/code although code is not in my $PATH.
After trying most of the above options, it looks like none of them are writing to stdout or stderr, --version and --help open vscode as if no options were given, and by default, vscode does not return immediately as I would expect should happen without the -w option. diff, -r, and -n seem to work as expected.
Here is the about information given from Help -> About in vscode:
Version 1.1.1
Commit def9e32
Date 2016-05-13T13:38:00.094Z
Shell 0.37.6
Renderer 49.0.2623.75
Node 5.10.0
The problem is likely because you're using an unofficial package that's not configured correctly. I'm guessing /usr/bin/visual-studio-code points at <path>/code instead of <path>/bin/code, that's likely how you fix it.
Some command line options will work, some that are evaluated before electron is touched (like --help, --version) however won't.
It looks like it was just a bug in the install script for the package, but thanks for the offer. The AUR is essentially just a community repository of build scripts for software that isn't in the offical repository, so, as long as the script builds the package correctly and has the correct dependancies, it should work as expected.
Linden Krouse (@Lindenk) the problem is if it's building from the vscode repository, it won't build vscode in full as there's a small portion of the configuration that's closed. Would the AUR package be able to leverage a properly packaged .tar.gz file? If so in what format should it be?
The build script for the package downloads the binary from here which seems to be the official build. Then it's extracted, installed and symlinked it to the (hopefully) correct locations. The script itself is managed by the community and is generally the standard for non-official Arch Linux packages. If you'd like to skim the script it's available here, but, other than the package getting a large amount of community support and being taken on by an official Arch Linux maintainer, I think keeping it as a package on the AUR is the most convenient way to provide vscode to the Arch Linux community.
Linden Krouse (@Lindenk) ok using VSCode-linux-x64-stable.zip should be relatively safe, you're just missing out on the post/pre install stuff in the deb/rpms files (mainly just the symlink at this point):
To clarify: the community packages are awesome, I just want to make sure the heavy lifting is done on our build system so things like this issue are avoided in the future 😃
Well, thanks for the help and interest! Usually these kinds of problems are pretty rare, but ultimately I would expect an install script to be difficult to maintain on your end in case something Arch Linux related causes breaking changes. I'll post a link to the other issue in the IRC in case anyone else in the community has some better input on the subject.
Hello! (Google dropped me here, but since this one is "Closed", I tried finding a similar open one from the GitHub issue finder, but gave up after wading through a few dozen irrelevant ones, except for #15435. Since I have the exact same problem as the title of this one here, I eventually chose this, sorry if it causes any trouble.)
v1.10.2, Win7(32-bit) here, everything's vanilla, AFAIK:
Extensions: Code Runner 0.6.14, PHP Debug 1.10.0, Remote VSCode 1.0.1 -- disabling them didn't help (see below).
code.exe --help just launches the editor, ignoring the option (-h, /h /? and all other desperate variants as well; code --version seems to be ignored, too).
code.exe --disable-extensions OTOH (which I tried following a hint from Daniel Imms (@Tyriar) above) does seem to work. Opening files from the command line works, too.
Then I even tried code.exe --disable-extensions --help, but nope.
(Please note: I'm just a user, I have no idea what "electron" is, and I like it that way. ;) Thanks, cheers!)
lunakid I believe you need to run code.cmd (aka code) to get the real command line interface, code.exe is the Electron executable that will launch the app.
Activity
Tyriar commentedon May 18, 2016
This was added a few versions ago:
Can you provide OS and if on Linux/OSX run
whereis codeand provide the output?Tyriar commentedon May 18, 2016
They're also documented on the website https://code.visualstudio.com/Docs/editor/codebasics#_additional-command-line-arguments
Lindenk commentedon May 18, 2016
Hmm, maybe it's just a bug then.
I'm using Arch Linux x86_64 using the AUR package for visual-studio-code. The output of
whereis visual-studio-code(which is the name it was installed as) gives:visual-studio-code: /usr/bin/visual-studio-codeEDIT:
whereis codegivescode: /opt/visual-studio-code/bin/codealthoughcodeis not in my $PATH.After trying most of the above options, it looks like none of them are writing to stdout or stderr,
--versionand--helpopen vscode as if no options were given, and by default, vscode does not return immediately as I would expect should happen without the-woption.diff,-r, and-nseem to work as expected.Here is the about information given from Help -> About in vscode:
Version 1.1.1
Commit def9e32
Date 2016-05-13T13:38:00.094Z
Shell 0.37.6
Renderer 49.0.2623.75
Node 5.10.0
Tyriar commentedon May 18, 2016
The problem is likely because you're using an unofficial package that's not configured correctly. I'm guessing
/usr/bin/visual-studio-codepoints at<path>/codeinstead of<path>/bin/code, that's likely how you fix it.Some command line options will work, some that are evaluated before electron is touched (like
--help,--version) however won't.Lindenk commentedon May 18, 2016
Ah, that seems to work. Thanks! I'll fix the AUR package for it as well.
Tyriar commentedon May 18, 2016
Linden Krouse (@Lindenk) cheers. Is there something I could do to help improve the quality of the package? I'm not too familiar with Arch Linux/AUR.
Lindenk commentedon May 18, 2016
It looks like it was just a bug in the install script for the package, but thanks for the offer. The AUR is essentially just a community repository of build scripts for software that isn't in the offical repository, so, as long as the script builds the package correctly and has the correct dependancies, it should work as expected.
Tyriar commentedon May 18, 2016
Linden Krouse (@Lindenk) the problem is if it's building from the vscode repository, it won't build vscode in full as there's a small portion of the configuration that's closed. Would the AUR package be able to leverage a properly packaged .tar.gz file? If so in what format should it be?
Tyriar commentedon May 18, 2016
Linden Krouse (@Lindenk) I'd love for installs on Arch Linux to be just as easy as deb/rpms are via the website.
Tyriar commentedon May 18, 2016
Linden Krouse (@Lindenk) I created #6495, if you could provide any insight on that issue it would be helpful :)
Lindenk commentedon May 18, 2016
The build script for the package downloads the binary from here which seems to be the official build. Then it's extracted, installed and symlinked it to the (hopefully) correct locations. The script itself is managed by the community and is generally the standard for non-official Arch Linux packages. If you'd like to skim the script it's available here, but, other than the package getting a large amount of community support and being taken on by an official Arch Linux maintainer, I think keeping it as a package on the AUR is the most convenient way to provide vscode to the Arch Linux community.
Tyriar commentedon May 18, 2016
Linden Krouse (@Lindenk) ok using VSCode-linux-x64-stable.zip should be relatively safe, you're just missing out on the post/pre install stuff in the deb/rpms files (mainly just the symlink at this point):
We're totally open to contributions if a .tar.gz that contained some install script would be better for example.
Tyriar commentedon May 18, 2016
To clarify: the community packages are awesome, I just want to make sure the heavy lifting is done on our build system so things like this issue are avoided in the future 😃
Lindenk commentedon May 18, 2016
Well, thanks for the help and interest! Usually these kinds of problems are pretty rare, but ultimately I would expect an install script to be difficult to maintain on your end in case something Arch Linux related causes breaking changes. I'll post a link to the other issue in the IRC in case anyone else in the community has some better input on the subject.
xparq commentedon Mar 21, 2017
Hello! (Google dropped me here, but since this one is "Closed", I tried finding a similar open one from the GitHub issue finder, but gave up after wading through a few dozen irrelevant ones, except for #15435. Since I have the exact same problem as the title of this one here, I eventually chose this, sorry if it causes any trouble.)
v1.10.2, Win7(32-bit) here, everything's vanilla, AFAIK:

Extensions: Code Runner 0.6.14, PHP Debug 1.10.0, Remote VSCode 1.0.1 -- disabling them didn't help (see below).
code.exe --helpjust launches the editor, ignoring the option (-h, /h /? and all other desperate variants as well;code --versionseems to be ignored, too).code.exe --disable-extensionsOTOH (which I tried following a hint from Daniel Imms (@Tyriar) above) does seem to work. Opening files from the command line works, too.Then I even tried
code.exe --disable-extensions --help, but nope.(Please note: I'm just a user, I have no idea what "electron" is, and I like it that way. ;) Thanks, cheers!)
Tyriar commentedon Mar 21, 2017
lunakid I believe you need to run
code.cmd(akacode) to get the real command line interface,code.exeis the Electron executable that will launch the app.xparq commentedon Mar 25, 2017
Ah, damn, indeed, thank you very much! (Still have no idea what "Electron" is, though. ;) )
Tyriar commentedon Mar 26, 2017
lunakid just the way you like it 😉
xparq commentedon Oct 14, 2017
Yeah, but that didn't help what I didn't like. ;)