本文整理匯總了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'], []);
}
};
示例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)
]);
});