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


TypeScript CodeSnippet.fromInternal方法代碼示例

本文整理匯總了TypeScript中vs/editor/contrib/snippet/common/snippet.CodeSnippet.fromInternal方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript CodeSnippet.fromInternal方法的具體用法?TypeScript CodeSnippet.fromInternal怎麽用?TypeScript CodeSnippet.fromInternal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vs/editor/contrib/snippet/common/snippet.CodeSnippet的用法示例。


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

示例1: snippetTest

		snippetTest((editor, cursor, codeSnippet, snippetController) => {
			editor.setSelections([
				new Selection(2, 7, 2, 7),
			]);

			codeSnippet = CodeSnippet.fromInternal('xo{{}}r');
			snippetController.run(codeSnippet, 1, 0, false);

			assert.equal(editor.getSelections().length, 1);
			assert.ok(editor.getSelection().equalsRange({ startLineNumber: 2, startColumn: 8, endColumn: 8, endLineNumber: 2 }));
		});
開發者ID:asotog,項目名稱:vscode,代碼行數:11,代碼來源:snippetController.test.ts

示例2: withMockCodeEditor

		withMockCodeEditor(lines, {}, (editor, cursor) => {
			editor.getModel().updateOptions({
				insertSpaces: false
			});
			let snippetController = editor.registerAndInstantiateContribution<TestSnippetController>(TestSnippetController);
			let codeSnippet = CodeSnippet.fromInternal([
				'for (var {{index}}; {{index}} < {{array}}.length; {{index}}++) {',
				'\tvar element = {{array}}[{{index}}];',
				'\t{{}}',
				'}'
			].join('\n'));

			cb(editor, cursor, codeSnippet, snippetController);

			snippetController.dispose();
		});
開發者ID:asotog,項目名稱:vscode,代碼行數:16,代碼來源:snippetController.test.ts

示例3: assertInternalAndTextmate

	function assertInternalAndTextmate(internal: string, textmate: string, callback: (snippet: CodeSnippet) => any) {

		callback(CodeSnippet.fromInternal(internal));
		callback(CodeSnippet.fromTextmate(textmate));
	}
開發者ID:GYGit,項目名稱:vscode,代碼行數:5,代碼來源:snippet.test.ts


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