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


TypeScript modes.CompletionProviderRegistry類代碼示例

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


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

示例1: test

	test('only from', function () {

		const foo: any = {
			triggerCharacters: [],
			provideCompletionItems() {
				return {
					currentWord: '',
					incomplete: false,
					suggestions: [{
						label: 'jjj',
						type: 'property',
						insertText: 'jjj'
					}]
				};
			}
		};
		const registration = CompletionProviderRegistry.register({ pattern: 'bar/path', scheme: 'foo' }, foo);

		provideSuggestionItems(model, new Position(1, 1), undefined, [foo]).then(items => {
			registration.dispose();

			assert.equal(items.length, 1);
			assert.ok(items[0].provider === foo);
		});
	});
開發者ID:VishalMadhvani,項目名稱:vscode,代碼行數:25,代碼來源:suggest.test.ts

示例2: setup

	setup(function () {

		model = TextModel.createFromString('FOO\nbar\BAR\nfoo', undefined, undefined, URI.parse('foo:bar/path'));
		registration = CompletionProviderRegistry.register({ pattern: 'bar/path', scheme: 'foo' }, {
			provideCompletionItems(_doc, pos) {
				return {
					incomplete: false,
					suggestions: [{
						label: 'aaa',
						kind: CompletionItemKind.Snippet,
						insertText: 'aaa',
						range: Range.fromPositions(pos)
					}, {
						label: 'zzz',
						kind: CompletionItemKind.Snippet,
						insertText: 'zzz',
						range: Range.fromPositions(pos)
					}, {
						label: 'fff',
						kind: CompletionItemKind.Property,
						insertText: 'fff',
						range: Range.fromPositions(pos)
					}]
				};
			}
		});
	});
開發者ID:VishalMadhvani,項目名稱:vscode,代碼行數:27,代碼來源:suggest.test.ts

示例3: registerCompletionItemProvider

export function registerCompletionItemProvider(languageId: string, provider: modes.CompletionItemProvider): IDisposable {
	return modes.CompletionProviderRegistry.register(languageId, provider);
}
開發者ID:ramesius,項目名稱:vscode,代碼行數:3,代碼來源:standaloneLanguages.ts


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