未验证 提交 4b9e0bba 编写于 作者: J Johannes Rieken 提交者: GitHub

Merge pull request #108964 from turara/fix-96545

Update OneSnippet#move method to fix #96545.
......@@ -115,7 +115,7 @@ export class OneSnippet {
const range = this._editor.getModel().getDecorationRange(id)!;
const currentValue = this._editor.getModel().getValueInRange(range);
operations.push(EditOperation.replaceMove(range, placeholder.transform.resolve(currentValue)));
operations.push(EditOperation.replace(range, placeholder.transform.resolve(currentValue)));
}
}
if (operations.length > 0) {
......
......@@ -561,6 +561,26 @@ suite('SnippetSession', function () {
assertSelections(editor, new Selection(2, 1, 2, 1));
});
// Refer to issue #96545.
test('snippets, transform adjacent to previous placeholder', function () {
editor.getModel()!.setValue('');
editor.setSelection(new Selection(1, 1, 1, 1));
const session = new SnippetSession(editor, '${1:{}${2:fff}${1/{/}/}');
session.insert();
assertSelections(editor, new Selection(1, 1, 1, 2), new Selection(1, 5, 1, 6));
session.next();
assert.equal(model.getValue(), '{fff}');
assertSelections(editor, new Selection(1, 2, 1, 5));
editor.trigger('test', 'type', { text: 'ggg' });
session.next();
assert.equal(model.getValue(), '{ggg}');
assert.equal(session.isAtLastPlaceholder, true);
assertSelections(editor, new Selection(1, 6, 1, 6));
});
test('Snippet placeholder index incorrect after using 2+ snippets in a row that each end with a placeholder, #30769', function () {
editor.getModel()!.setValue('');
editor.setSelection(new Selection(1, 1, 1, 1));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册