Skip to content

Commit 224d4be

Browse files
committed
Reduce some indentation
1 parent 6b6e73b commit 224d4be

1 file changed

Lines changed: 35 additions & 37 deletions

File tree

src/vs/platform/extensionManagement/node/extensionManagementService.ts

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -190,43 +190,41 @@ export class ExtensionManagementService extends Disposable implements IExtension
190190
install(vsix: URI, type: LocalExtensionType = LocalExtensionType.User): Promise<IExtensionIdentifier> {
191191
this.logService.trace('ExtensionManagementService#install', vsix.toString());
192192
return createCancelablePromise(token => {
193-
return this.downloadVsix(vsix)
194-
.then(downloadLocation => {
195-
const zipPath = path.resolve(downloadLocation.fsPath);
196-
197-
return getManifest(zipPath)
198-
.then(manifest => {
199-
const identifier = { id: getLocalExtensionIdFromManifest(manifest) };
200-
if (manifest.engines && manifest.engines.vscode && !isEngineValid(manifest.engines.vscode)) {
201-
return Promise.reject(new Error(nls.localize('incompatible', "Unable to install extension '{0}' as it is not compatible with VS Code '{1}'.", identifier.id, pkg.version)));
202-
}
203-
return this.removeIfExists(identifier.id)
204-
.then(
205-
() => {
206-
const extensionIdentifier = { id: getGalleryExtensionId(manifest.publisher, manifest.name) };
207-
return this.getInstalled(LocalExtensionType.User)
208-
.then(installedExtensions => {
209-
const newer = installedExtensions.filter(local => areSameExtensions(extensionIdentifier, { id: getGalleryExtensionIdFromLocal(local) }) && semver.gt(local.manifest.version, manifest.version))[0];
210-
return newer ? this.uninstall(newer, true) : null;
211-
})
212-
.then(() => {
213-
this.logService.info('Installing the extension:', identifier.id);
214-
this._onInstallExtension.fire({ identifier, zipPath });
215-
return this.getMetadata(getGalleryExtensionId(manifest.publisher, manifest.name))
216-
.then(
217-
metadata => this.installFromZipPath(identifier, zipPath, metadata, type, token),
218-
error => this.installFromZipPath(identifier, zipPath, null, type, token))
219-
.then(
220-
() => { this.logService.info('Successfully installed the extension:', identifier.id); return identifier; },
221-
e => {
222-
this.logService.error('Failed to install the extension:', identifier.id, e.message);
223-
return Promise.reject(e);
224-
});
225-
});
226-
},
227-
e => Promise.reject(new Error(nls.localize('restartCode', "Please restart VS Code before reinstalling {0}.", manifest.displayName || manifest.name))));
228-
});
229-
});
193+
return this.downloadVsix(vsix).then(downloadLocation => {
194+
const zipPath = path.resolve(downloadLocation.fsPath);
195+
196+
return getManifest(zipPath)
197+
.then(manifest => {
198+
const identifier = { id: getLocalExtensionIdFromManifest(manifest) };
199+
if (manifest.engines && manifest.engines.vscode && !isEngineValid(manifest.engines.vscode)) {
200+
return Promise.reject(new Error(nls.localize('incompatible', "Unable to install extension '{0}' as it is not compatible with VS Code '{1}'.", identifier.id, pkg.version)));
201+
}
202+
return this.removeIfExists(identifier.id).then(
203+
() => {
204+
const extensionIdentifier = { id: getGalleryExtensionId(manifest.publisher, manifest.name) };
205+
return this.getInstalled(LocalExtensionType.User)
206+
.then(installedExtensions => {
207+
const newer = installedExtensions.filter(local => areSameExtensions(extensionIdentifier, { id: getGalleryExtensionIdFromLocal(local) }) && semver.gt(local.manifest.version, manifest.version))[0];
208+
return newer ? this.uninstall(newer, true) : null;
209+
})
210+
.then(() => {
211+
this.logService.info('Installing the extension:', identifier.id);
212+
this._onInstallExtension.fire({ identifier, zipPath });
213+
return this.getMetadata(getGalleryExtensionId(manifest.publisher, manifest.name))
214+
.then(
215+
metadata => this.installFromZipPath(identifier, zipPath, metadata, type, token),
216+
error => this.installFromZipPath(identifier, zipPath, null, type, token))
217+
.then(
218+
() => { this.logService.info('Successfully installed the extension:', identifier.id); return identifier; },
219+
e => {
220+
this.logService.error('Failed to install the extension:', identifier.id, e.message);
221+
return Promise.reject(e);
222+
});
223+
});
224+
},
225+
e => Promise.reject(new Error(nls.localize('restartCode', "Please restart VS Code before reinstalling {0}.", manifest.displayName || manifest.name))));
226+
});
227+
});
230228
});
231229
}
232230

0 commit comments

Comments
 (0)