How to install all VS Code workspace extensions programatically - visual-studio-code

When VS Code opens in a folder with .vscode/extensions.json present the user has the option to Install All recommended extensions.
How can the Install All function be invoked programatically (i.e. without human interaction) using the command line or VS Code API?

It doesn't look like the "Install All" action is associated with a command you could call via the vscode.commands API.
The easiest solution is probably to parse .vscode/extensions.json yourself. You could then simply run code --install-extension <extension-id> for each of the extension IDs you find.

Related

Install VS Code extension during development?

I am developing an extension for VS Code. This extension is already good enough for me to use during daily work, but not good enough to be published (yet). Is there a canonical way to make an unpublished extension under development available to VS Code? Optimally, I would like to always have the current state of the code running.
I did find a way that seems to work, but I'm not sure whether this is a terrible hack or okay: Create a symbolic link in VS Code's extensions directory (~/.vscode/extensions on Linux) to the development directory. Is there a better/official way?
You can package your extension (even if it's in development) using vsce with the command vsce package. This will create a .vsix file which you can install in your regular instance of VSCode in the marketplace menu (click on the ... icon at the top and select "Install from .vsix file).
If you need to view the logs of the extension, go to Help>Toggle Developer tools and use the console to view your extension's output (if there is any).

How do I open an Electron app from the command line?

Question
I want to open a installed electron app from the Command prompt. Similar to Visual Studio Code. Typing code opens VScode.
How to do something like that? I also want to provide custom arguments when opening from CLI. Example:-
printapp --option1=foo --option2
Then, in the app I would use those to perform different tasks. Is this possible? I want it to be cross-platform? It should not have .exe extensions. I want it to be like VScode. It should not be something like this:-
printapp.exe --options
Other References
Take a look at https://hyper.is. It also has a CLI to open the app and do tasks. I want something like hyper or VScode. Even atom has something similar like this.
Other possibilities
If opening a app from the command line is impossible in electron,
is there a way to bundle a CLI with a app using electron-builder (I would bundle a Node JS CLI with the app and when the user installs my app, they could use the GUI / CLI, without installing the CLI separately. Something like hyper I mentioned above)?
If possible, I would use the extra files option in electron-builder and move the CLI to the resources folder and set the PATH variable. But,
It may not be cross-platform
How to set the PATH variable when installing a app? (I don't know macros)
Any method to open the app from the CLI which is cross-platform is appreciated.

VSCode CLI install extension from local file with powershell

I am trying to use PowerShell to install a VSCode extension from a local file (not from the internet).
When I use Start-Process and give the appropriate file path, it opens VSCode, stalls the script, and does not install the extension. When I close VSCode, the script terminates without error, but still the extensions is not installed.
I need the exact syntax to install a VSCode extension from PowerShell silently (no new window).
I've tried just about every syntax variation.
Thanks
Instead of using Start-Process, call the default name for VS Code: code. VS Code has some nice CLI options when you call this, one of which is --install-extension. Heres an example of what you can call in powershell or in a .ps1 script that would do this:
code --install-extension path/to/extension.ts
or if you have made an extension pack to help automate the install of multiple extensions at once:
code --install-extension path/to/extensionPack.vsix

Is it possible to open a C# solution in Rider via the command line?

It's possible with VS code via installing a shell command, as seen in this SO question: How to open Visual Studio Code from the command line on OSX?
Is the same thing possible with Jetbrain's Rider?
It is possible to open any file, folder, or solution and project in Rider for editing.
Here is a corresponding help page.
If you use a standalone Rider, you need to create a shell script. Call the action "Tools | Create Command-Line Launcher...". Then you will be able to call rider in a terminal as the shell script is by default created in /usr/local/bin.
In the case of using Toolbox installations, all scripts should be generated using Toolbox. Take a look at Create Command-line Launcher Intellij not found to find out how to set it in Toolbox.
Rider, in my case at least, and I installed it on Linux via snap, comes with a built-in rider command. It does open Rider, however, the issue is that the terminal becomes an output for logs from Rider. Additionally, as soon as I close the terminal, Rider gets closed as well. I guess the Rider process becomes a child process of the shell instance that I used to invoke it.

Is it possible to have Visual Studio Code custom configured from a .ps1 file?

I'm attempting to put together a standard VS Code build for my company. I have a ps1 file that copies/installs extensions for VS Code after it's been installed but I can't seem to find how or even if it is possible to then configure VS Code settings to utilize those extensions.
For example, one of the extensions is "vscode-icons". I can install the extension just fine but then the user needs to setup his preferences manually to actually use the extension by going to the File->Preferences->File Icon Theme->VS Code Icons.
Is it possible to have my ps1 install file actually make configuration changes so any user who opens VS Code has the custom configuration settings?
The config settings for VS Code are JSON files - just needs to locate and edit them.
First check what manual change is doing then create part in the script to edit the settings.
https://code.visualstudio.com/docs/customization/userandworkspace