本文整理汇总了TypeScript中vs/editor/contrib/linesOperations/common/linesOperations.JoinLinesAction类的典型用法代码示例。如果您正苦于以下问题:TypeScript JoinLinesAction类的具体用法?TypeScript JoinLinesAction怎么用?TypeScript JoinLinesAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JoinLinesAction类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: JoinLinesAction
], {}, (editor, cursor) => {
let model = editor.getModel();
let joinLinesAction = new JoinLinesAction();
editor.setSelections([
/** primary cursor */
new Selection(5, 2, 5, 2),
new Selection(1, 2, 1, 2),
new Selection(3, 2, 4, 2),
new Selection(5, 4, 6, 3),
new Selection(7, 5, 8, 4),
new Selection(10, 1, 10, 1)
]);
joinLinesAction.run(null, editor);
assert.equal(model.getLinesContent().join('\n'), 'hello world\nhello world\nhello world\nhello world\n\nhello world', '001');
assert.deepEqual(editor.getSelections().toString(), [
/** primary cursor */
new Selection(3, 4, 3, 8),
new Selection(1, 6, 1, 6),
new Selection(2, 2, 2, 8),
new Selection(4, 5, 4, 9),
new Selection(6, 1, 6, 1)
].toString(), '002');
/** primary cursor */
assert.deepEqual(editor.getSelection().toString(), new Selection(3, 4, 3, 8).toString(), '003');
});
开发者ID:jhasse,项目名称:vscode,代码行数:28,代码来源:linesOperations.test.ts
示例2: JoinLinesAction
], {}, (editor, cursor) => {
let model = editor.getModel();
let joinLinesAction = new JoinLinesAction();
editor.setSelection(new Selection(1, 6, 1, 6));
editor.trigger('keyboard', Handler.Type, { text: ' my dear' });
assert.equal(model.getLineContent(1), 'hello my dear');
assert.deepEqual(editor.getSelection(), new Selection(1, 14, 1, 14));
joinLinesAction.run(null, editor);
assert.equal(model.getLineContent(1), 'hello my dear world');
assert.deepEqual(editor.getSelection(), new Selection(1, 14, 1, 14));
editor.trigger('keyboard', Handler.Undo, {});
assert.equal(model.getLineContent(1), 'hello my dear');
assert.deepEqual(editor.getSelection(), new Selection(1, 14, 1, 14));
});
开发者ID:gokulakrishna9,项目名称:vscode,代码行数:18,代码来源:linesOperations.test.ts
注:本文中的vs/editor/contrib/linesOperations/common/linesOperations.JoinLinesAction类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论