0

Is there a consistent/universal way to query a list of previous versions of a VS Code extension similar to how it is displayed after selecting the option Install another version... from the extension page as mentioned here? I am aware of checking the version history of an extension on the marketplace, but that usually only shows the recent 5 versions as mentioned in this SO post. I have also seen that some github pages for an extension keep a relative updated changelog and even tags such as the python extension, but some such as the extension Database Client do not show a detailed changelog of versions like it is displayed in VS Code's extension page. For instance for this extension cweijan.vscode-mysql-client2, I can see version 6.4.3 all the way back to version 2.0.0. mysql_db_gif_vscode If I wanted to download version 2.5.7, I can download the .vsix file directly from https://marketplace.visualstudio.com/_apis/public/gallery/publishers/cweijan/vsextensions/vscode-mysql-client2/2.5.7/vspackage.

Long story short, is there a straightforward way to query such a list of all previous versions of an extension?

kyrlon
  • 1,065
  • 2
  • 8
  • 16

2 Answers2

2

You can use the vsce api tool from the terminal to query the list of published versions of the extension pack.

on Linux OS, you can install it with the npm package manager:

sudo apt update    
sudo apt install nodejs
sudo npm install -g npm@latest
npm install -g vsce

And then to query the available versions:

vsce show <publisher>.<package> --json

The version numbers are found in the "versions" field of the json structure

kyrlon
  • 1,065
  • 2
  • 8
  • 16
0

An extension's marketplace page should have a "Version History" tab showing versions (which as you said, only shows the five most recent versions), but in that page, also a "CHANGE LOG" link, so I'd check that out.

Aside from that,

If the maintainer follows some common practices like tagging commits with version numbers, you can just look at the git tags.

If the maintainer publishes commits for each version to a public git repo, you can clone it (do a shallow clone if you want to save space) and run the following git command, which greps all commits for lines containing "version": in package.json files (extension manifests):

git --no-pager grep -h '"version":' $(git rev-list --all) -- 'package.json'

If you want to strip out everything but the version number and you're on a UNIX-like platform, you can append | grep -E --only-matching '[0-9]+\.[0-9]+\.[0-9]+'. And then you can redirect the output to a file (Ex. on Bash: append > versions.txt to the very end of the command line).

See also How to grep (search) committed code in the Git history.

starball
  • 20,030
  • 7
  • 43
  • 238
  • This is a great idea, but not universal for every extension. The database extension version on the marketplace states it is on 6.4.3 where as github states the latest is only at 3.9.8 from `package.json` (as of 5/9/23) – kyrlon May 09 '23 at 20:45