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


TypeScript platform.Registry類代碼示例

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


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

示例1: run

	public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): TPromise<void> {
		const quickOpenService = accessor.get(IQuickOpenService);

		if (!editor.getModel()) {
			return;
		}

		const {lineNumber, column} = editor.getPosition();
		const modeId = editor.getModel().getModeIdAtPosition(lineNumber, column);

		const picks: ISnippetPick[] = [];
		Registry.as<ISnippetsRegistry>(Extensions.Snippets).visitSnippets(modeId, snippet => {
			picks.push({
				label: snippet.prefix,
				detail: snippet.description,
				snippet
			});
			return true;
		});

		return quickOpenService.pick(picks).then(pick => {
			if (pick) {
				SnippetController.get(editor).insertSnippet(pick.snippet.codeSnippet, 0, 0);
			}
		});
	}
開發者ID:sandy081,項目名稱:vscode,代碼行數:26,代碼來源:snippetCompletion.ts

示例2: _registerLanguages

	_registerLanguages(desc: ILanguageExtensionPoint[]): void {
		if (desc.length === 0) {
			return;
		}

		for (let i = 0; i < desc.length; i++) {
			this._registerLanguage(desc[i]);
		}

		// Rebuild fast path maps
		this._mimeTypesMap = {};
		this._nameMap = {};
		this._lowercaseNameMap = {};
		Object.keys(this._languages).forEach((langId) => {
			let language = this._languages[langId];
			if (language.name) {
				this._nameMap[language.name] = language.identifier;
			}
			language.aliases.forEach((alias) => {
				this._lowercaseNameMap[alias.toLowerCase()] = language.identifier;
			});
			language.mimetypes.forEach((mimetype) => {
				this._mimeTypesMap[mimetype] = language.identifier;
			});
		});

		Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerOverrideIdentifiers(ModesRegistry.getLanguages().map(language => language.id));
	}
開發者ID:FabianLauer,項目名稱:vscode,代碼行數:28,代碼來源:languagesRegistry.ts

示例3: getDefaultValues

export function getDefaultValues(): any {
	const valueTreeRoot: any = Object.create(null);
	const properties = Registry.as<IConfigurationRegistry>(Extensions.Configuration).getConfigurationProperties();
	for (let key in properties) {
		let value = properties[key].default;
		addToValueTree(valueTreeRoot, key, value);
	}
	return valueTreeRoot;
}
開發者ID:,項目名稱:,代碼行數:9,代碼來源:

示例4: getDefaultValues

export function getDefaultValues(): any {
	const valueTreeRoot: any = Object.create(null);
	const properties = Registry.as<IConfigurationRegistry>(Extensions.Configuration).getConfigurationProperties();

	for (let key in properties) {
		let value = properties[key].default;
		addToValueTree(valueTreeRoot, key, value, message => console.error(`Conflict in default settings: ${message}`));
	}

	return valueTreeRoot;
}
開發者ID:StateFarmIns,項目名稱:vscode,代碼行數:11,代碼來源:model.ts

示例5: test

	test("Viewlet extension point and registration", function() {
		assert(Types.isFunction(Platform.Registry.as(Extensions.Viewlets).registerViewlet));
		assert(Types.isFunction(Platform.Registry.as(Extensions.Viewlets).getViewlet));
		assert(Types.isFunction(Platform.Registry.as(Extensions.Viewlets).getViewlets));

		let oldCount = Platform.Registry.as(Extensions.Viewlets).getViewlets().length;
		let d = new ViewletDescriptor("moduleId", "ctorName", "reg-test-id", "name");
		Platform.Registry.as(Extensions.Viewlets).registerViewlet(d);

		assert(d === Platform.Registry.as(Extensions.Viewlets).getViewlet("reg-test-id"));
		assert.equal(oldCount + 1, Platform.Registry.as(Extensions.Viewlets).getViewlets().length);
	});
開發者ID:578723746,項目名稱:vscode,代碼行數:12,代碼來源:viewlet.test.ts

示例6: test

	test('Viewlet extension point and registration', function () {
		assert(Types.isFunction(Platform.Registry.as(Extensions.Viewlets).registerViewlet));
		assert(Types.isFunction(Platform.Registry.as(Extensions.Viewlets).getViewlet));
		assert(Types.isFunction(Platform.Registry.as(Extensions.Viewlets).getViewlets));

		let oldCount = Platform.Registry.as(Extensions.Viewlets).getViewlets().length;
		let d = new ViewletDescriptor('moduleId', 'ctorName', 'reg-test-id', 'name');
		Platform.Registry.as(Extensions.Viewlets).registerViewlet(d);

		assert(d === Platform.Registry.as(Extensions.Viewlets).getViewlet('reg-test-id'));
		assert.equal(oldCount + 1, Platform.Registry.as(Extensions.Viewlets).getViewlets().length);
	});
開發者ID:FabianLauer,項目名稱:vscode,代碼行數:12,代碼來源:viewlet.test.ts

示例7: registerContributions

export function registerContributions(): void {

	// configuration
	Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfiguration({
		'id': 'problems',
		'order': 101,
		'title': Messages.PROBLEMS_PANEL_CONFIGURATION_TITLE,
		'type': 'object',
		'properties': {
			'problems.autoReveal': {
				'description': Messages.PROBLEMS_PANEL_CONFIGURATION_AUTO_REVEAL,
				'type': 'boolean',
				'default': true
			}
		}
	});

	// markers panel
	Registry.as<PanelRegistry>(PanelExtensions.Panels).registerPanel(new PanelDescriptor(
		'vs/workbench/parts/markers/browser/markersPanel',
		'MarkersPanel',
		Constants.MARKERS_PANEL_ID,
		Messages.MARKERS_PANEL_TITLE_PROBLEMS,
		'markersPanel',
		10,
		ToggleMarkersPanelAction.ID
	));

	// actions
	const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
	registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleMarkersPanelAction, ToggleMarkersPanelAction.ID, ToggleMarkersPanelAction.LABEL, {
		primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_M
	}), 'View: Show Problems', Messages.MARKERS_PANEL_VIEW_CATEGORY);

	// Retaining old action to show errors and warnings, so that custom bindings to this action for existing users works.
	registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleErrorsAndWarningsAction, ToggleErrorsAndWarningsAction.ID, ToggleErrorsAndWarningsAction.LABEL), 'Show Errors and Warnings');
}
開發者ID:diarmaidm,項目名稱:vscode,代碼行數:37,代碼來源:markersWorkbenchContributions.ts

示例8: test

	test("Workbench Action Registration", function() {
		let Registry = Platform.Registry.as(Extensions.WorkbenchActions);

		let d = new SyncActionDescriptor(MyClass, "id", "name");

		let oldActions = Registry.getWorkbenchActions().slice(0);
		let oldCount = Registry.getWorkbenchActions().length;

		Registry.registerWorkbenchAction(d);
		Registry.registerWorkbenchAction(d);

		assert.equal(Registry.getWorkbenchActions().length, 1 + oldCount);
		assert.strictEqual(d, Registry.getWorkbenchAction("id"));

		Registry.setWorkbenchActions(oldActions);
	});
開發者ID:578723746,項目名稱:vscode,代碼行數:16,代碼來源:actionRegistry.test.ts

示例9: test

	test('Test registering the language property', () => {
		Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfiguration({
			'id': '[a]',
			'order': 1,
			'title': 'a',
			'type': 'object',
			'properties': {
				'[a]': {
					'description': 'a',
					'type': 'boolean',
					'default': false,
				}
			}
		});
		assert.equal(undefined, new model.DefaultConfigModel().getContentsFor('[a]'));
	});
開發者ID:diarmaidm,項目名稱:vscode,代碼行數:16,代碼來源:model.test.ts

示例10: test

	test('Test registering the same property again', () => {
		Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfiguration({
			'id': 'a',
			'order': 1,
			'title': 'a',
			'type': 'object',
			'properties': {
				'a': {
					'description': 'a',
					'type': 'boolean',
					'default': false,
				}
			}
		});
		assert.equal(true, new DefaultConfigurationModel().getContentsFor('a'));
	});
開發者ID:FabianLauer,項目名稱:vscode,代碼行數:16,代碼來源:model.test.ts


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