mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Reapply extension management edits that were removed in 1.31 merge (#4606)
This commit is contained in:
@@ -404,7 +404,12 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
|
||||
|
||||
getCompatibleExtension(arg1: IExtensionIdentifier | IGalleryExtension, version?: string): Promise<IGalleryExtension | null> {
|
||||
const extension: IGalleryExtension | null = isIExtensionIdentifier(arg1) ? null : arg1;
|
||||
if (extension && extension.properties.engine && isEngineValid(extension.properties.engine)) {
|
||||
// {{SQL CARBON EDIT}}
|
||||
// Change to original version: removed the extension version validation
|
||||
// Reason: This method is used to find the matching gallery extension for the locally installed extension,
|
||||
// since we only have one entry for each extension (not in-scope to enable mutiple version support for now),
|
||||
// if the new version of extension is not compatible, the extension won't be displayed properly.
|
||||
if (extension) {
|
||||
return Promise.resolve(extension);
|
||||
}
|
||||
const { id, uuid } = extension ? extension.identifier : <IExtensionIdentifier>arg1;
|
||||
|
||||
@@ -195,6 +195,9 @@ export class ExtensionManagementService extends Disposable implements IExtension
|
||||
}
|
||||
|
||||
install(vsix: URI, type: ExtensionType = ExtensionType.User): Promise<IExtensionIdentifier> {
|
||||
// {{SQL CARBON EDIT}}
|
||||
let startTime = new Date().getTime();
|
||||
|
||||
this.logService.trace('ExtensionManagementService#install', vsix.toString());
|
||||
return createCancelablePromise(token => {
|
||||
return this.downloadVsix(vsix).then(downloadLocation => {
|
||||
@@ -205,7 +208,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
|
||||
const identifier = { id: getGalleryExtensionId(manifest.publisher, manifest.name) };
|
||||
let operation: InstallOperation = InstallOperation.Install;
|
||||
// {{SQL CARBON EDIT - Check VSCode and ADS version}}
|
||||
if (manifest.engines && manifest.engines.vscode && (!isEngineValid(manifest.engines.vscode, product.vscodeVersion) || (manifest.engines.azdata && !isEngineValid(manifest.engines.azdata, pkg.version)))) {
|
||||
if (manifest.engines && ((manifest.engines.vscode && !isEngineValid(manifest.engines.vscode, product.vscodeVersion)) || (manifest.engines.azdata && !isEngineValid(manifest.engines.azdata, pkg.version)))) {
|
||||
return Promise.reject(new Error(nls.localize('incompatible', "Unable to install version '{2}' of extension '{0}' as it is not compatible with Azure Data Studio '{1}'.", identifier.id, pkg.version, manifest.version)));
|
||||
}
|
||||
const identifierWithVersion = new ExtensionIdentifierWithVersion(identifier, manifest.version);
|
||||
@@ -229,7 +232,11 @@ export class ExtensionManagementService extends Disposable implements IExtension
|
||||
// Until there's a gallery for SQL Ops Studio, skip retrieving the metadata from the gallery
|
||||
return this.installExtension({ zipPath, identifierWithVersion, metadata: null }, type, token)
|
||||
.then(
|
||||
local => { this._onDidInstallExtension.fire({ identifier, zipPath, local, operation: InstallOperation.Install }); return identifier; },
|
||||
local => {
|
||||
this.reportTelemetry(this.getTelemetryEvent(InstallOperation.Install), getLocalExtensionTelemetryData(local), new Date().getTime() - startTime, void 0);
|
||||
this._onDidInstallExtension.fire({ identifier, zipPath, local, operation: InstallOperation.Install });
|
||||
return identifier;
|
||||
},
|
||||
error => { this._onDidInstallExtension.fire({ identifier, zipPath, error, operation: InstallOperation.Install }); return Promise.reject(error); }
|
||||
);
|
||||
// return this.getMetadata(getGalleryExtensionId(manifest.publisher, manifest.name))
|
||||
|
||||
Reference in New Issue
Block a user