當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ExtensionsRegistry.getExtensionDescription方法代碼示例

本文整理匯總了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);
		});
開發者ID:1Hgm,項目名稱:vscode,代碼行數:8,代碼來源:abstractExtensionService.ts

示例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);
		}
	}
開發者ID:1Hgm,項目名稱:vscode,代碼行數:40,代碼來源:abstractExtensionService.ts


注:本文中的vs/platform/extensions/common/extensionsRegistry.ExtensionsRegistry.getExtensionDescription方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。