在Windows上,使用powershell脚本。这将返回一个“友好的名字”;它更好地反映了名称,因为它将出现在Visual Studio Code UI中(code --list-extensions没有做到):
<#
.SYNOPSIS
Lists installed Visual Studio Code Extensions in a friendly format.
.DESCRIPTION
Lists installed Visual Studio Code Extensions in a friendly format.
.INPUTS
None. You cannot pipe objects to this.
.OUTPUTS
A list of installed Visual Studio Code Extensions in a friendly format.
.EXAMPLE
PS> .\List-Extensions.ps1
.NOTES
Author: John Bentley
Version: 2022-07-11 18:55
Latest at: [How can you export the Visual Studio Code extension list?
> John Bentley's Answer]
(https://stackoverflow.com/a/72929878/872154)
#>
# Change to your directory
$packages = Get-ChildItem C:/Users/John/.vscode/extensions/*/package.json
Function Out-JsonItem($File) {
$json = Get-Content $File | ConvertFrom-Json
$extensionMetaData = [PSCustomObject]@{
# This is the name that appears in the Visual Studio Code UI,
# Extensions Tab
FriendlyName =
if ($json.displayName) { $json.displayName } else { $json.name }
# Name = $json.name
PublisherAndName = $json.publisher + '.' + $json.name
Description = $json.description
}
return $extensionMetaData
}
$extensions = ($packages | ForEach-Object { Out-JsonItem -File $_ })
$extensions.GetEnumerator() | Sort-Object {$_.FriendlyName}
# Alternate sorting (Same order as `code --list-extensions`).
# $extensions.GetEnumerator() | Sort-Object {$_.PublisherAndName}
示例输出:
FriendlyName PublisherAndName
------------ ----------------
[Deprecated] Debugger for Chrome msjsdiag.debugger-for-chrome
%displayName% ms-vscode-remote.remote-wsl
Apache Conf mrmlnc.vscode-apache
Apache Conf Snippets eiminsasete.apacheconf-snippets
Auto Close Tag formulahendry.auto-close-tag
Beautify HookyQR.beautify
Blank Line Organizer rintoj.blank-line-organizer
change-case wmaurer.change-case
Character Count stevensona.character-count
...
Word Count ms-vscode.wordcount
Word Count OliverKovacs.word-count
XML redhat.vscode-xml
XML Tools DotJoshJohnson.xml
XML Tools qub.qub-xml-vscode
XPath Notebook for Visual Studio Code deltaxml.xpath-notebook
XSLT/XPath for Visual Studio Code deltaxml.xslt-xpath