如何在我的 vscode 扩展中获取最新版本号? [英] How can I get the latest version number in my vscode extension?
问题描述
当我的 vscode 扩展更新时,向用户显示一条信息消息.ps:如何在我的vscode扩展中获取最新版本号?
when my vscode extension is updated, Show an information message to users。 ps:How can I get the latest version number in my vscode extension?
推荐答案
要获取扩展版本和其他信息,请参阅
To get the extension version and other info, see
扩展作者现在可以使用新的 extension
属性ExtensionContext
,传入扩展的activate
功能.这将返回相同的 Extension
实例vscode.extensions.getExtension(
返回,其中包含扩展的 id、版本等属性,以及序列化的 packageJSON
属性,您可以在其中直接访问数据来自您扩展程序的 package.json
文件.
Extension property on ExtensionContext menu
Extension authors can now use the new
extension
property onExtensionContext
, which is passed into the extension'sactivate
function. This returns the sameExtension
instance thatvscode.extensions.getExtension(<extension-id>)
returns, which contains properties such as, the extension's id, version, as well as a serializedpackageJSON
property where you can access data directly from your extension'spackage.json
file.
来自 v1.55 发行说明
这篇关于如何在我的 vscode 扩展中获取最新版本号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!