本文整理匯總了TypeScript中vs/platform/extensions/common/extensionsRegistry.ExtensionsRegistry.getExtensionDescription方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ExtensionsRegistry.getExtensionDescription方法的具體用法?TypeScript ExtensionsRegistry.getExtensionDescription怎麽用?TypeScript ExtensionsRegistry.getExtensionDescription使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/platform/extensions/common/extensionsRegistry.ExtensionsRegistry
的用法示例。
在下文中一共展示了ExtensionsRegistry.getExtensionDescription方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Error
return this._onReady.then(() => {
let desc = ExtensionsRegistry.getExtensionDescription(extensionId);
if (!desc) {
throw new Error('Extension `' + extensionId + '` is not known');
}
return this._activateExtensions([desc], 0);
});
示例2: _handleActivateRequest
/**
* Handle semantics related to dependencies for `currentExtension`.
* semantics: `redExtensions` must wait for `greenExtensions`.
*/
private _handleActivateRequest(currentExtension: IExtensionDescription, greenExtensions: { [id: string]: IExtensionDescription; }, redExtensions: IExtensionDescription[]): void {
let depIds = (typeof currentExtension.extensionDependencies === 'undefined' ? [] : currentExtension.extensionDependencies);
let currentExtensionGetsGreenLight = true;
for (let j = 0, lenJ = depIds.length; j < lenJ; j++) {
let depId = depIds[j];
let depDesc = ExtensionsRegistry.getExtensionDescription(depId);
if (!depDesc) {
// Error condition 1: unknown dependency
this._showMessage(Severity.Error, nls.localize('unknownDep', "Extension `{1}` failed to activate. Reason: unknown dependency `{0}`.", depId, currentExtension.id));
this._activatedExtensions[currentExtension.id] = this._createFailedExtension();
return;
}
if (hasOwnProperty.call(this._activatedExtensions, depId)) {
let dep = this._activatedExtensions[depId];
if (dep.activationFailed) {
// Error condition 2: a dependency has already failed activation
this._showMessage(Severity.Error, nls.localize('failedDep1', "Extension `{1}` failed to activate. Reason: dependency `{0}` failed to activate.", depId, currentExtension.id));
this._activatedExtensions[currentExtension.id] = this._createFailedExtension();
return;
}
} else {
// must first wait for the dependency to activate
currentExtensionGetsGreenLight = false;
greenExtensions[depId] = depDesc;
}
}
if (currentExtensionGetsGreenLight) {
greenExtensions[currentExtension.id] = currentExtension;
} else {
redExtensions.push(currentExtension);
}
}