From 238dd4a9968acd8e4eb310241527940c2bcdd951 Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Tue, 24 Nov 2015 16:48:40 -0500 Subject: [PATCH] Improve Update Notifier --- src/utils/UpdateNotifier.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utils/UpdateNotifier.ts b/src/utils/UpdateNotifier.ts index 8357a9d..078b0b9 100644 --- a/src/utils/UpdateNotifier.ts +++ b/src/utils/UpdateNotifier.ts @@ -1,6 +1,6 @@ 'use strict'; -import { window } from 'vscode'; +import { window, commands } from 'vscode'; import { ExtensionManifestReader } from './ManifestUtils'; let req = require('request'); @@ -27,7 +27,12 @@ export function checkForUpdates() { let latestVersion = release.name.substring(1); // the telease/tag is prefixed with a "v" if (!release.draft && semver.gt(latestVersion, currentVersion)) { - window.showInformationMessage(`Version ${latestVersion} of the ${manifestReader.displayName} extension is available.`); + let updateNowLabel = 'Update Now'; + window.showInformationMessage(`Version ${latestVersion} of the ${manifestReader.displayName} extension is available.`, updateNowLabel).then((clicked) => { + if (clicked == updateNowLabel) { + commands.executeCommand('workbench.extensions.action.installExtension', manifestReader.displayName); + } + }); } } });