VS Code Desktop pre-install extensions

Hi everyone! I have Coder installed on a on-premises redhat VM and I'm currently trying to configure pre-installed extensios in a Docker Container starter template. I followed this guide here to add the extensions .vsix files to the image and install it in the startup script https://coder.com/docs/user-guides/workspace-access/vscode#adding-extensions-to-custom-images. However, by doing that only the code-server (web browser) had the extensions installed, the VS Code Desktop option starts without them. I saw at the end of the doc above that for VS Code Desktop to pick up I should use code --extensions-dir ~/.vscode-server/extensions --install-extension "$extension", but it does not have code installed. Since I'm already running it in a sort of an air-gapped environment, I tryed to install it using the --extensions-dir ~/.vscode-server/extensions at the end of the startup script like "code-server --install-extension /vsix/GitHub.copilot.vsix --extensions-dir ~/.vscode-server/extensions" and it seems to have installed in the VS Code Desktop but not on the code-server (web). I don't have much knowledge of the differences in the code desktop and the server one, but is there a way to install the extensions once and use it with both desktop and server options?
Coder
Visual Studio Code | Coder Docs
Use VSCode with Coder in the desktop or browser
Solution:
Hi, thank you both for the response! I will check the possibility to allow in the firewall the installation of the VS Code Web since it may be exactly what we want. The VS Code Web installs the extensions from the microsoft marketplace or from the openvsx? Also, I managed to make it work by using the code-server --install-extension ... --extensions-dir in the image and copying the installed extensions folder to the expected location on both the desktop and code-server. Although this is not the intended way to use, it may be useful to validate. Just commenting here cause I didn't find much about this topic that was already posted....
Jump to solution
10 Replies
Codercord
Codercord4w ago
Codercord
Codercord4w ago
What are you creating this issue for?
Phorcys
Phorcys4w ago
hey @GR8B8, the --extensions-dir ~/.vscode-server/extensions flag is for VSCode Desktop, remove it if you want to preinstall extensions for code-server
GR8B8
GR8B8OP4w ago
Hey @Phorcys thanks for the fast response! I want to install the extension on both VS Code Desktop and code-server. Is there a way to do this or do I need to run code-server --install-extension /vsix/GitHub.copilot.vsix --extensions-dir ~/.vscode-server/extensions for VS Code Desktop and then code-server --install-extension /vsix/GitHub.copilot.vsix for code-server to install the same extension for both?
Phorcys
Phorcys4w ago
yup you'll need to run both wait hold on for code-server you don't need the commands anymore you can just set the extensions variable in the module call see "Pre-install Extensions" in https://registry.coder.com/modules/coder/code-server seems we don't have anything like this for vscode desktop just yet though
matifali
matifali4w ago
If you use the VSCode web module and set the extensions variable it should install those extensions for both the VSCode and the VSCode web. You may have to tinker a bit to make it air gapped friendly
Solution
GR8B8
GR8B84w ago
Hi, thank you both for the response! I will check the possibility to allow in the firewall the installation of the VS Code Web since it may be exactly what we want. The VS Code Web installs the extensions from the microsoft marketplace or from the openvsx? Also, I managed to make it work by using the code-server --install-extension ... --extensions-dir in the image and copying the installed extensions folder to the expected location on both the desktop and code-server. Although this is not the intended way to use, it may be useful to validate. Just commenting here cause I didn't find much about this topic that was already posted.
Phorcys
Phorcys3w ago
yeah VSCode Web uses the Microsoft marketplace
Phorcys
Phorcys3w ago
thanks for following up! this will help out other people :)
Codercord
Codercord3w ago
@Phorcys closed the thread.

Did you find this page helpful?