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


TypeScript editorBrowser.IActiveCodeEditor類代碼示例

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


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

示例1: assertSelections

	function assertSelections(editor: IActiveCodeEditor, ...s: Selection[]) {
		for (const selection of editor.getSelections()) {
			const actual = s.shift()!;
			assert.ok(selection.equalsSelection(actual), `actual=${selection.toString()} <> expected=${actual.toString()}`);
		}
		assert.equal(s.length, 0);
	}
開發者ID:eamodio,項目名稱:vscode,代碼行數:7,代碼來源:snippetSession.test.ts

示例2: Selection

	test('snippets, newline NO whitespace adjust', () => {

		editor.setSelection(new Selection(2, 5, 2, 5));
		const session = new SnippetSession(editor, 'abc\n    foo\n        bar\n$0', 0, 0, false);
		session.insert();
		assert.equal(editor.getModel()!.getValue(), 'function foo() {\n    abc\n    foo\n        bar\nconsole.log(a);\n}');
	});
開發者ID:eamodio,項目名稱:vscode,代碼行數:7,代碼來源:snippetSession.test.ts

示例3: function

	test('snippets, merge', function () {
		editor.setSelection(new Selection(1, 1, 1, 1));
		const session = new SnippetSession(editor, 'This ${1:is ${2:nested}}.$0');
		session.insert();
		session.next();
		assertSelections(editor, new Selection(1, 9, 1, 15));

		session.merge('really ${1:nested}$0');
		assertSelections(editor, new Selection(1, 16, 1, 22));

		session.next();
		assertSelections(editor, new Selection(1, 22, 1, 22));
		assert.equal(session.isAtLastPlaceholder, false);

		session.next();
		assert.equal(session.isAtLastPlaceholder, true);
		assertSelections(editor, new Selection(1, 23, 1, 23));

		session.prev();
		editor.trigger('test', 'type', { text: 'AAA' });

		// back to `really ${1:nested}`
		session.prev();
		assertSelections(editor, new Selection(1, 16, 1, 22));

		// back to `${1:is ...}` which now grew
		session.prev();
		assertSelections(editor, new Selection(1, 6, 1, 25));
	});
開發者ID:eamodio,項目名稱:vscode,代碼行數:29,代碼來源:snippetSession.test.ts

示例4: SnippetSession

	test('Selecting text from left to right, and choosing item messes up code, #31199', function () {
		const model = editor.getModel()!;
		model.setValue('console.log');

		let actual = SnippetSession.adjustSelection(model, new Selection(1, 12, 1, 9), 3, 0);
		assert.ok(actual.equalsSelection(new Selection(1, 9, 1, 6)));

		actual = SnippetSession.adjustSelection(model, new Selection(1, 9, 1, 12), 3, 0);
		assert.ok(actual.equalsSelection(new Selection(1, 9, 1, 12)));

		editor.setSelections([new Selection(1, 9, 1, 12)]);
		new SnippetSession(editor, 'far', 3, 0).insert();
		assert.equal(model.getValue(), 'console.far');
	});
開發者ID:eamodio,項目名稱:vscode,代碼行數:14,代碼來源:snippetSession.test.ts


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