本文整理汇总了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;未经允许,请勿转载。 |
请发表评论