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


TypeScript commandTestUtils.createSingleEditOp函數代碼示例

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


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

示例1: repeatStr

		var testOutdent = (tabSize: number, oneIndent: string, lineText:string, expectedIndents:number) => {
			var expectedIndent = repeatStr(oneIndent, expectedIndents);
			if (lineText.length > 0) {
				_assertUnshiftCommand(tabSize, oneIndent, [lineText + 'aaa'], [createSingleEditOp(expectedIndent, 1, 1, 1, lineText.length + 1)]);
			} else {
				_assertUnshiftCommand(tabSize, oneIndent, [lineText + 'aaa'], []);
			}
		};
開發者ID:13572293130,項目名稱:vscode,代碼行數:8,代碼來源:shiftCommand.test.ts

示例2: test

	test('remove trailing whitespace', function () {
		assertTrimTrailingWhitespaceCommand([''], []);
		assertTrimTrailingWhitespaceCommand(['text'], []);
		assertTrimTrailingWhitespaceCommand(['text   '], [createSingleEditOp(null, 1, 5, 1, 8)]);
		assertTrimTrailingWhitespaceCommand(['text\t   '], [createSingleEditOp(null, 1, 5, 1, 9)]);
		assertTrimTrailingWhitespaceCommand(['\t   '], [createSingleEditOp(null, 1, 1, 1, 5)]);
		assertTrimTrailingWhitespaceCommand(['text\t'], [createSingleEditOp(null, 1, 5, 1, 6)]);
		assertTrimTrailingWhitespaceCommand([
			'some text\t',
			'some more text',
			'\t  ',
			'even more text  ',
			'and some mixed\t   \t'
		], [
				createSingleEditOp(null, 1, 10, 1, 11),
				createSingleEditOp(null, 3, 1, 3, 4),
				createSingleEditOp(null, 4, 15, 4, 17),
				createSingleEditOp(null, 5, 15, 5, 20)
			]);


		assertTrimTrailingWhitespace(['text   '], [new Position(1, 1), new Position(1, 2), new Position(1, 3)], [createInsertDeleteSingleEditOp(null, 1, 5, 1, 8)]);
		assertTrimTrailingWhitespace(['text   '], [new Position(1, 1), new Position(1, 5)], [createInsertDeleteSingleEditOp(null, 1, 5, 1, 8)]);
		assertTrimTrailingWhitespace(['text   '], [new Position(1, 1), new Position(1, 5), new Position(1, 6)], [createInsertDeleteSingleEditOp(null, 1, 6, 1, 8)]);
		assertTrimTrailingWhitespace([
			'some text\t',
			'some more text',
			'\t  ',
			'even more text  ',
			'and some mixed\t   \t'
		], [], [
				createInsertDeleteSingleEditOp(null, 1, 10, 1, 11),
				createInsertDeleteSingleEditOp(null, 3, 1, 3, 4),
				createInsertDeleteSingleEditOp(null, 4, 15, 4, 17),
				createInsertDeleteSingleEditOp(null, 5, 15, 5, 20)
			]);
		assertTrimTrailingWhitespace([
			'some text\t',
			'some more text',
			'\t  ',
			'even more text  ',
			'and some mixed\t   \t'
		], [new Position(1, 11), new Position(3, 2), new Position(5, 1), new Position(4, 1), new Position(5, 10)], [
				createInsertDeleteSingleEditOp(null, 3, 2, 3, 4),
				createInsertDeleteSingleEditOp(null, 4, 15, 4, 17),
				createInsertDeleteSingleEditOp(null, 5, 15, 5, 20)
			]);
	});
開發者ID:Chan-PH,項目名稱:vscode,代碼行數:48,代碼來源:trimTrailingWhitespaceCommand.test.ts


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