The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,953 other followers

Installing vscode extensions from within the Visual Studio Code terminal was way easier than I anticipated

Posted by jpluimers on 2022/11/09

Having missed quite a lot of Visual Studio Code releases during my metastasised rectum cancer treatment and recovery, it had become both very mature, but also very reliant of having the right extensions installed.

In that period, the extension marketplace grew remarkably, so I really wanted an easy way to install them from within the inside vscode integrated Windows Terminal.

A while ago I wrote How can you export the Visual Studio Code extension list? (via: Stack Overflow), which generated a small script with code --install-extension <extension-name> lines so I could executed those from the command-line for Visual Studio installations on new machines.

Boy was I surprised that you can just as well execute them from the [Wayback/Archive] Integrated Terminal in Visual Studio Code as well (:

When doing so, the Visual Studio Code instance around that Integrated Terminal will automatically pick up the new extension.

I found that with a [Wayback/Archive] vscode install extension from within visual studio code console – Google Search and bumping in the video also embedded below the signature: [Archive] VS Code tips — Installing extensions from the command line using –install-extension – YouTube.

The video also showed that the installation syntax can also include the version number like this:

code --install-extension DavidAnson.vscode-markdownlint@0.44.4

So I in addition to a batch script that dumps all installed extensions from my blog post above:

@for /f %%l in ('code --list-extensions') do @echo code --install-extension %%l

I also made one that includes the version numbers:

@for /f %%l in ('code --list-extensions --show-versions') do @echo code --install-extension %%l

It produces output like the above installation line including @ sign and version number.

 

Finally I learned a few things from [Wayback/Archive] cmd – How to install Visual Studio Code extensions from Command line – Stack Overflow.

First [Wayback/Archive] Shan Khan taught me how to uninstall:

To make it easier to automate and configure VS Code, it is possible to list, install, and uninstall extensions from the command line. When identifying an extension, provide the full name of the form publisher.extension, for example donjayamanne.python.
code --list-extensions
code --install-extension ms-vscode.cpptools
code --uninstall-extension ms-vscode.csharp

then [Wayback/Archive] Peterino to upgrade without questions asked:

Updating an extension is now possible using the --force option with --install-extension. (See GitHub issue [Wayback/A] #58434, commit [Wayback/Archive] 1dd7326)

and [Wayback/Archive] User Wade Anderson that you can also install from a local .vsix installation file:

You can manually install an VS Code extension packaged in a .vsix file. Simply install using the VS Code command line providing the path to the .vsix file.
code --install-extension myExtensionFolder\myExtension.vsix
The extension will be installed under your user .vscode/extensions folder. You may provide multiple .vsix files on the command line to install multiple extensions at once.

Further reading

Some more links from the above Google search:

–jeroen


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: