Skip to content

Instantly share code, notes, and snippets.

@joseluisq
Last active October 30, 2024 10:44
Show Gist options
  • Save joseluisq/4740e37a9f2358357381e308aa39c52d to your computer and use it in GitHub Desktop.
Save joseluisq/4740e37a9f2358357381e308aa39c52d to your computer and use it in GitHub Desktop.
How to export your VS Code extensions from terminal

How to export your VS Code extensions from terminal

Note: Unix-like systems only.

  1. Export your extensions to a shell file:
code --list-extensions | sed -e 's/^/code --install-extension /' > my_vscode_extensions.sh
  1. Verify your extensions installer file:
less my_vscode_extesions.sh

Install your extensions (optional)

Run your my_vscode_extensions.sh using Bash command:

bash my_vscode_extensions.sh
@Siniliote
Copy link

@joseluisq
My version in my wsl :

~ code -v
1.46.1
cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
x64

@Siniliote
Copy link

It's very strange...
Works with CLI cmd.exe and powershell.exe.
Not with wsl 2 in Ubuntu.

With CLI wsl 2

~ code --help
code 1.46.1

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.
  --folder-uri <uri>                Opens a window with given folder uri(s)
  --file-uri <uri>                  Opens a window with given file uri(s)
  -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
  --category                           Filters installed extensions by provided category, when using --list-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).
  --telemetry                        Shows all telemetry events which VS code collects.

With CLI cmd.exe

C:\Users\siniliote>code --help
Visual Studio Code 1.46.1

Usage: code.exe [options][paths...]

To read output from another program, append '-' (e.g. 'echo Hello World | code.exe -')

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.
  --folder-uri <uri>                Opens a window with given folder uri(s)
  --file-uri <uri>                  Opens a window with given file uri(s)
  -w --wait                         Wait for the files to be closed before
                                    returning.
  --locale <locale>                 The locale to use (e.g. en-US or zh-TW).
  --user-data-dir <dir>             Specifies the directory that user data is
                                    kept in. Can be used to open multiple
                                    distinct instances of Code.
  -h --help                         Print usage.

Extensions Management
  --extensions-dir <dir>                            Set the root path for
                                                    extensions.
  --list-extensions                                 List the installed
                                                    extensions.
  --show-versions                                   Show versions of installed
                                                    extensions, when using
                                                    --list-extension.
  --category                                        Filters installed
                                                    extensions by provided
                                                    category, when using
                                                    --list-extension.
  --install-extension <extension-id | path-to-vsix> Installs or updates the
                                                    extension. Use `--force`
                                                    argument to avoid
                                                    prompts.
  --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).
  --telemetry                        Shows all telemetry events which VS code
                                     collects.

@Siniliote
Copy link

I'm solved... In my wsl/ubuntu it's vscode-server not vscode.

@joseluisq
Copy link
Author

👍

@braebo
Copy link

braebo commented May 19, 2021

is it possible to filter by enabled extensions?

@Binly42
Copy link

Binly42 commented Oct 16, 2021

is it possible to filter by enabled extensions?

sadly seems impossible ... (microsoft/vscode#112088 (comment)

@avelops
Copy link

avelops commented Sep 18, 2023

thanks! this works with gitpod.io web IDE :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment