Improve Update Notifier

This commit is contained in:
Josh Johnson 2015-11-24 16:48:40 -05:00
parent 2275c834ff
commit 238dd4a996
1 changed files with 7 additions and 2 deletions

View File

@ -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);
}
});
}
}
});