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


TypeScript extensionsRegistry.ExtensionsRegistry類代碼示例

本文整理匯總了TypeScript中vs/platform/extensions/common/extensionsRegistry.ExtensionsRegistry的典型用法代碼示例。如果您正苦於以下問題:TypeScript ExtensionsRegistry類的具體用法?TypeScript ExtensionsRegistry怎麽用?TypeScript ExtensionsRegistry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ExtensionsRegistry類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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:

Monaco.Languages.onLanguage = (languageId:string, callback:()=>void) => {
	let isDisposed = false;
	ExtensionsRegistry.registerOneTimeActivationEventListener('onLanguage:' + languageId, () => {
		if (!isDisposed) {
			callback();
		}
	});
	return {
		dispose: () => { isDisposed = true; }
	};
};
開發者ID:Buildsoftwaresphere,項目名稱:vscode,代碼行數:11,代碼來源:standaloneEditor.ts

示例3: _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

示例4: localize

		}
	};

	export const commandsContribution: IJSONSchema = {
		description: localize('vscode.extension.contributes.commands', "Contributes commands to the command palette."),
		oneOf: [
			commandType,
			{
				type: 'array',
				items: commandType
			}
		]
	};
}

ExtensionsRegistry.registerExtensionPoint<schema.IUserFriendlyCommand | schema.IUserFriendlyCommand[]>('commands', schema.commandsContribution).setHandler(extensions => {

	const ids = new IdGenerator('contrib-cmd-icon-');

	function handleCommand(userFriendlyCommand: schema.IUserFriendlyCommand , extension: IExtensionPointUser<any>) {

		if (!schema.isValidCommand(userFriendlyCommand, extension.collector)) {
			return;
		}

		let {icon, category, title, command} = userFriendlyCommand;
		let iconClass: string;
		if (icon) {
			iconClass = ids.nextId();
			if (typeof icon === 'string') {
				const path = join(extension.description.extensionFolderPath, icon);
開發者ID:baltth,項目名稱:vscode,代碼行數:31,代碼來源:menusExtensionPoint.ts

示例5:

		let required: string[] = [];
		if (Array.isArray(value.required)) {
			for (let element of value.required) {
				if (Types.isString(element)) {
					required.push(element);
				}
			}
		}
		return { extensionId, taskType, required: required.length >= 0 ? required : undefined, properties: value.properties ? Objects.deepClone(value.properties) : undefined };
	}
}


const taskDefinitionsExtPoint = ExtensionsRegistry.registerExtensionPoint<Configuration.TaskDefinition[]>('taskDefinitions', [], {
	description: nls.localize('TaskDefinitionExtPoint', 'Contributes task kinds'),
	type: 'array',
	items: taskDefinitionSchema
});

export interface ITaskDefinitionRegistry {
	onReady(): TPromise<void>;

	get(key: string): Tasks.TaskDefinition;
	all(): Tasks.TaskDefinition[];
}

class TaskDefinitionRegistryImpl implements ITaskDefinitionRegistry {

	private taskTypes: IStringDictionary<Tasks.TaskDefinition>;
	private readyPromise: TPromise<void>;
開發者ID:AlexxNica,項目名稱:sqlopsstudio,代碼行數:30,代碼來源:taskDefinitionRegistry.ts

示例6: localize

	};

	export const viewsContribution: IJSONSchema = {
		description: localize('vscode.extension.contributes.views', "Contributes views to the editor"),
		type: 'object',
		properties: {
			'explorer': {
				description: localize('views.explorer', "Explorer View"),
				type: 'array',
				items: viewDescriptor
			}
		}
	};
}

ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: schema.IUserFriendlyViewDescriptor[] }>('views', [], schema.viewsContribution).setHandler(extensions => {
	for (let extension of extensions) {
		const { value, collector } = extension;

		forEach(value, entry => {
			if (!schema.isValidViewDescriptors(entry.value, collector)) {
				return;
			}

			const location = schema.parseLocation(entry.key);
			if (!location) {
				collector.warn(localize('locationId.invalid', "`{0}` is not a valid view location", entry.key));
				return;
			}

			const viewDescriptors = entry.value.map(item => ({
開發者ID:FabianLauer,項目名稱:vscode,代碼行數:31,代碼來源:viewsExtensionPoint.ts

示例7: localize

		}
	}
};

const tabContributionSchema: IJSONSchema = {
	description: localize('sqlops.extension.contributes.tabs', "Contributes a single or multiple tabs for users to add to their dashboard."),
	oneOf: [
		tabSchema,
		{
			type: 'array',
			items: tabSchema
		}
	]
};

ExtensionsRegistry.registerExtensionPoint<IDashboardTabContrib | IDashboardTabContrib[]>('dashboard.tabs', [], tabContributionSchema).setHandler(extensions => {

	function handleCommand(tab: IDashboardTabContrib, extension: IExtensionPointUser<any>) {
		let { description, container, title, when, id, alwaysShow } = tab;

		// If always show is not specified, set it to true by default.
		if (!types.isBoolean(alwaysShow)) {
			alwaysShow = true;
		}
		let publisher = extension.description.publisher;
		if (!title) {
			extension.collector.error(localize('dashboardTab.contribution.noTitleError', 'No title specified for extension.'));
			return;
		}

		if (!description) {
開發者ID:AlexxNica,項目名稱:sqlopsstudio,代碼行數:31,代碼來源:dashboardTab.contribution.ts

示例8: localize

ExtensionsRegistry.registerExtensionPoint('localizations', [], {
	description: localize('vscode.extension.contributes.localizations', "Contributes localizations to the editor"),
	type: 'array',
	items: {
		type: 'object',
		properties: {
			languageId: {
				description: localize('vscode.extension.contributes.localizations.languageId', 'Id of the language into which the display strings are translated.'),
				type: 'string'
			},
			languageName: {
				description: localize('vscode.extension.contributes.localizations.languageName', 'Name of the language in English.'),
				type: 'string'
			},
			languageNameLocalized: {
				description: localize('vscode.extension.contributes.localizations.languageNameLocalized', 'Name of the language in contributed language.'),
				type: 'string'
			},
			translations: {
				description: localize('vscode.extension.contributes.localizations.translations', 'List of translations associated to the language.'),
				type: 'array',
				default: [],
				items: {
					type: 'object',
					properties: {
						id: {
							type: 'string',
							description: localize('vscode.extension.contributes.localizations.translations.id', "Id of VS Code or Extension for which this translation is contributed to. Id of VS Code is always `vscode` and of extension should be in format `publisherId.extensionName`."),
							pattern: '^((vscode)|([a-z0-9A-Z][a-z0-9\-A-Z]*)\\.([a-z0-9A-Z][a-z0-9\-A-Z]*))$',
							patternErrorMessage: localize('vscode.extension.contributes.localizations.translations.id.pattern', "Id should be `vscode` or in format `publisherId.extensionName` for translating VS code or an extension respectively.")
						},
						path: {
							type: 'string',
							description: localize('vscode.extension.contributes.localizations.translations.path', "A relative path to a file containing translations for the language.")
						}
					}
				}
			}
		}
	}
});
開發者ID:igolskyi,項目名稱:vscode,代碼行數:41,代碼來源:localizations.ts

示例9:

export const grammarsExtPoint: IExtensionPoint<ITMSyntaxExtensionPoint[]> = ExtensionsRegistry.registerExtensionPoint<ITMSyntaxExtensionPoint[]>('grammars', [languagesExtPoint], {
	description: nls.localize('vscode.extension.contributes.grammars', 'Contributes textmate tokenizers.'),
	type: 'array',
	defaultSnippets: [{ body: [{ language: '${1:id}', scopeName: 'source.${2:id}', path: './syntaxes/${3:id}.tmLanguage.' }] }],
	items: {
		type: 'object',
		defaultSnippets: [{ body: { language: '${1:id}', scopeName: 'source.${2:id}', path: './syntaxes/${3:id}.tmLanguage.' } }],
		properties: {
			language: {
				description: nls.localize('vscode.extension.contributes.grammars.language', 'Language identifier for which this syntax is contributed to.'),
				type: 'string'
			},
			scopeName: {
				description: nls.localize('vscode.extension.contributes.grammars.scopeName', 'Textmate scope name used by the tmLanguage file.'),
				type: 'string'
			},
			path: {
				description: nls.localize('vscode.extension.contributes.grammars.path', 'Path of the tmLanguage file. The path is relative to the extension folder and typically starts with \'./syntaxes/\'.'),
				type: 'string'
			},
			embeddedLanguages: {
				description: nls.localize('vscode.extension.contributes.grammars.embeddedLanguages', 'A map of scope name to language id if this grammar contains embedded languages.'),
				type: 'object'
			},
			injectTo: {
				description: nls.localize('vscode.extension.contributes.grammars.injectTo', 'List of language scope names to which this grammar is injected to.'),
				type: 'array',
				items: {
					type: 'string'
				}
			}
		},
		required: ['scopeName', 'path']
	}
});
開發者ID:FabianLauer,項目名稱:vscode,代碼行數:35,代碼來源:TMGrammars.ts

示例10: registerDashboardWidget

import { IInsightsConfig } from './interfaces';
import { insightsContribution, insightsSchema } from 'sql/parts/dashboard/widgets/insights/insightsWidgetSchemas';

import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { Registry } from 'vs/platform/registry/common/platform';

const insightRegistry = Registry.as<IInsightRegistry>(InsightExtensions.InsightContribution);

interface IInsightTypeContrib {
	id: string;
	contrib: IInsightsConfig;
}

registerDashboardWidget('insights-widget', '', insightsSchema);

ExtensionsRegistry.registerExtensionPoint<IInsightTypeContrib | IInsightTypeContrib[]>('dashboard.insights', [], insightsContribution).setHandler(extensions => {

	function handleCommand(insight: IInsightTypeContrib, extension: IExtensionPointUser<any>) {

		if (insight.contrib.queryFile) {
			insight.contrib.queryFile = join(extension.description.extensionFolderPath, insight.contrib.queryFile);
		}

		if (insight.contrib.details && insight.contrib.details.queryFile) {
			insight.contrib.details.queryFile = join(extension.description.extensionFolderPath, insight.contrib.details.queryFile);
		}

		registerNonCustomDashboardWidget(insight.id, '', insight.contrib);
		insightRegistry.registerExtensionInsight(insight.id, insight.contrib);
	}
開發者ID:AlexxNica,項目名稱:sqlopsstudio,代碼行數:30,代碼來源:insightsWidget.contribution.ts


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