move api to azdata (#6517)

* move api to azdata

* comments
This commit is contained in:
Alan Ren
2019-07-30 19:06:46 -07:00
committed by GitHub
parent 3f5bdb86cd
commit 892a8b5ced
7 changed files with 5339 additions and 5287 deletions

View File

@@ -9,15 +9,23 @@ import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { IExtensionManagementService, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
import { URI } from 'vs/base/common/uri';
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { localize } from 'vs/nls';
import { IWindowService } from 'vs/platform/windows/common/windows';
@extHostNamedCustomer(SqlMainContext.MainThreadExtensionManagement)
export class MainThreadExtensionManagement implements MainThreadExtensionManagementShape {
private _toDispose: IDisposable[];
private _obsoleteExtensionApiUsageNotificationShown: boolean = false;
constructor(
extHostContext: IExtHostContext,
@IExtensionManagementService private _extensionService: IExtensionManagementService
@IExtensionManagementService private _extensionService: IExtensionManagementService,
@IConfigurationService private _configurationService: IConfigurationService,
@INotificationService private _notificationService: INotificationService,
@IWindowService protected readonly _windowService: IWindowService
) {
this._toDispose = [];
}
@@ -29,4 +37,31 @@ export class MainThreadExtensionManagement implements MainThreadExtensionManagem
public $install(vsixPath: string): Thenable<string> {
return this._extensionService.install(URI.file(vsixPath)).then((value: ILocalExtension) => { return undefined; }, (reason: any) => { return reason ? reason.toString() : undefined; });
}
public $showObsoleteExtensionApiUsageNotification(message: string): void {
console.warn(message);
if (this._obsoleteExtensionApiUsageNotificationShown) {
return;
}
let enableObsoleteAPINotification = this._configurationService.getValue('workbench')['enableObsoleteApiUsageNotification'];
if (enableObsoleteAPINotification !== undefined && !enableObsoleteAPINotification) {
return;
}
this._notificationService.prompt(Severity.Warning,
localize('workbench.generalObsoleteApiNotification', "Some of the loaded extensions are using obsolete APIs, please find the detailed information in the Console tab of Developer Tools window"),
[{
label: localize('dontShowAgain', "Don't Show Again"),
run: () => {
this._configurationService.updateValue('workbench.enableObsoleteApiUsageNotification', false, ConfigurationTarget.USER);
},
isSecondary: true
}, {
label: localize('devTools', "Open Developer Tools"),
run: () => this._windowService.openDevTools()
}]);
this._obsoleteExtensionApiUsageNotificationShown = true;
}
}