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


TypeScript editorCommon.ICommonCodeEditor類代碼示例

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


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

示例1: assertFindState

	function assertFindState(editor: ICommonCodeEditor, cursor: number[], highlighted: number[], findDecorations: number[][]): void {
		assert.deepEqual(fromRange(editor.getSelection()), cursor, 'cursor');

		let expectedState = {
			highlighted: highlighted ? [highlighted] : [],
			findDecorations: findDecorations
		};
		assert.deepEqual(_getFindState(editor), expectedState, 'state');
	}
開發者ID:elibarzilay,項目名稱:vscode,代碼行數:9,代碼來源:findModel.test.ts

示例2: run

	public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): TPromise<void> {
		const debugService = accessor.get(IDebugService);
		const panelService = accessor.get(IPanelService);

		const text = editor.getModel().getValueInRange(editor.getSelection());
		return debugService.addReplExpression(text)
			.then(() => panelService.openPanel(REPL_ID, true))
			.then(_ => void 0);
	}
開發者ID:thinhpham,項目名稱:vscode,代碼行數:9,代碼來源:debugEditorActions.ts

示例3: runEditorCommand

	public runEditorCommand(accessor: ServicesAccessor, editor: ICommonCodeEditor, args: any): void {
		const config = editor.getConfiguration();
		const wordSeparators = getMapForWordSeparators(config.wordSeparators);
		const model = editor.getModel();
		const selections = editor.getSelections();

		const result = selections.map((sel) => {
			const inPosition = new Position(sel.positionLineNumber, sel.positionColumn);
			const outPosition = this._move(wordSeparators, model, inPosition, this._wordNavigationType);
			return this._moveTo(sel, outPosition, this._inSelectionMode);
		});

		editor.setSelections(result);
		if (result.length === 1) {
			const pos = new Position(result[0].positionLineNumber, result[0].positionColumn);
			editor.revealPosition(pos, false, true);
		}
	}
開發者ID:jhasse,項目名稱:vscode,代碼行數:18,代碼來源:wordOperations.ts

示例4: runEditorCommand

	public runEditorCommand(accessor: ServicesAccessor, editor: ICommonCodeEditor, args: any): void {
		const config = editor.getConfiguration();
		const wordSeparators = getMapForWordSeparators(config.wordSeparators);
		const model = editor.getModel();
		const selections = editor.getSelections();

		const result = selections.map((sel) => {
			const inPosition = new Position(sel.positionLineNumber, sel.positionColumn);
			const outPosition = this._move(wordSeparators, model, inPosition, this._wordNavigationType);
			return this._moveTo(sel, outPosition, this._inSelectionMode);
		});

		editor._getCursors().setStates('moveWordCommand', CursorChangeReason.NotSet, result.map(r => CursorState.fromModelSelection(r)));
		if (result.length === 1) {
			const pos = new Position(result[0].positionLineNumber, result[0].positionColumn);
			editor.revealPosition(pos, ScrollType.Smooth);
		}
	}
開發者ID:armanio123,項目名稱:vscode,代碼行數:18,代碼來源:wordOperations.ts

示例5: run

	public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): void {
		const configurationEditingService = accessor.get(IConfigurationEditingService);
		const messageService = accessor.get(IMessageService);

		let newRenderControlCharacters = !editor.getConfiguration().viewInfo.renderControlCharacters;

		configurationEditingService.writeConfiguration(ConfigurationTarget.USER, { key: 'editor.renderControlCharacters', value: newRenderControlCharacters }).then(null, error => {
			messageService.show(Severity.Error, error);
		});
	}
開發者ID:diarmaidm,項目名稱:vscode,代碼行數:10,代碼來源:toggleRenderControlCharacter.ts

示例6: function

	test('text edit with reversed selection', function () {

		const session = new SnippetSession(editor, '${1:bar}$0');
		editor.setSelections([new Selection(2, 5, 2, 5), new Selection(1, 1, 1, 1)]);

		session.insert();
		assert.equal(model.getValue(), 'barfunction foo() {\n    barconsole.log(a);\n}');
		assertSelections(editor, new Selection(2, 5, 2, 8), new Selection(1, 1, 1, 4));
	});
開發者ID:vnvizitiu,項目名稱:vscode,代碼行數:9,代碼來源:snippetSession.test.ts

示例7: function

	test('text edits & selection', function () {
		const session = new SnippetSession(editor, 'foo${1:bar}foo$0');
		session.insert();
		assert.equal(editor.getModel().getValue(), 'foobarfoofunction foo() {\n    foobarfooconsole.log(a);\n}');

		assertSelections(editor, new Selection(1, 4, 1, 7), new Selection(2, 8, 2, 11));
		session.next();
		assertSelections(editor, new Selection(1, 10, 1, 10), new Selection(2, 14, 2, 14));
	});
開發者ID:armanio123,項目名稱:vscode,代碼行數:9,代碼來源:snippetSession.test.ts

示例8: function

	test('snippets, don\'t merge touching tabstops 2/2', function () {

		const session = new SnippetSession(editor, '$1$2$3$0');
		session.insert();
		assertSelections(editor, new Selection(1, 1, 1, 1), new Selection(2, 5, 2, 5));

		editor.trigger('test', 'type', { text: '111' });

		session.next();
		assertSelections(editor, new Selection(1, 4, 1, 4), new Selection(2, 8, 2, 8));
		editor.trigger('test', 'type', { text: '222' });

		session.next();
		assertSelections(editor, new Selection(1, 7, 1, 7), new Selection(2, 11, 2, 11));
		editor.trigger('test', 'type', { text: '333' });

		session.next();
		assert.equal(session.isAtLastPlaceholder, true);
	});
開發者ID:FabianLauer,項目名稱:vscode,代碼行數:19,代碼來源:snippetSession.test.ts

示例9: runPreview

	private runPreview(): boolean {

		// Select Outline Position
		let range = this.toSelection();
		this.editor.revealRangeInCenter(range);

		// Decorate if possible
		this.decorator.decorateLine(this.range, this.editor);

		return false;
	}
開發者ID:BlackstarSoon,項目名稱:vscode,代碼行數:11,代碼來源:quickOutline.ts


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