提交 1912fcae 编写于 作者: O oriash93

fixed review notes

上级 26831288
...@@ -7,6 +7,7 @@ import { localize } from 'vs/nls'; ...@@ -7,6 +7,7 @@ import { localize } from 'vs/nls';
import product from 'vs/platform/node/product'; import product from 'vs/platform/node/product';
import pkg from 'vs/platform/node/package'; import pkg from 'vs/platform/node/package';
import * as path from 'path'; import * as path from 'path';
import * as semver from 'semver';
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import { sequence } from 'vs/base/common/async'; import { sequence } from 'vs/base/common/async';
...@@ -113,13 +114,6 @@ class Main { ...@@ -113,13 +114,6 @@ class Main {
.filter(e => !/\.vsix$/i.test(e)) .filter(e => !/\.vsix$/i.test(e))
.map(id => () => { .map(id => () => {
return this.extensionManagementService.getInstalled(LocalExtensionType.User).then(installed => { return this.extensionManagementService.getInstalled(LocalExtensionType.User).then(installed => {
const isInstalled = installed.some(e => getId(e.manifest) === id);
if (isInstalled) {
console.log(localize('alreadyInstalled', "Extension '{0}' is already installed.", id));
return TPromise.as(null);
}
return this.extensionGalleryService.query({ names: [id], source: 'cli' }) return this.extensionGalleryService.query({ names: [id], source: 'cli' })
.then<IPager<IGalleryExtension>>(null, err => { .then<IPager<IGalleryExtension>>(null, err => {
if (err.responseText) { if (err.responseText) {
...@@ -143,7 +137,7 @@ class Main { ...@@ -143,7 +137,7 @@ class Main {
const installedExtension = installed.filter(e => getId(e.manifest) === id)[0]; const installedExtension = installed.filter(e => getId(e.manifest) === id)[0];
const installedVersion = installedExtension.manifest.version; const installedVersion = installedExtension.manifest.version;
const newestVersion = extension.version; const newestVersion = extension.version;
const shouldUpdate = installedVersion !== newestVersion; const shouldUpdate = semver.gt(newestVersion, installedVersion);
if (shouldUpdate) { if (shouldUpdate) {
console.log(localize('foundNewerVersion', "Installed version is '{0}', found newer version '{1}' in the marketplace.", installedVersion, newestVersion)); console.log(localize('foundNewerVersion', "Installed version is '{0}', found newer version '{1}' in the marketplace.", installedVersion, newestVersion));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册