mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
optionally allow to specify selection at which to insert a snippet, #19116
This commit is contained in:
@@ -49,7 +49,7 @@ suite('editor tests', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('insert snippet with replacement', () => {
|
||||
test('insert snippet with replacement, editor selection', () => {
|
||||
const snippetString = new SnippetString()
|
||||
.appendText('has been');
|
||||
|
||||
@@ -67,6 +67,24 @@ suite('editor tests', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('insert snippet with replacement, selection as argument', () => {
|
||||
const snippetString = new SnippetString()
|
||||
.appendText('has been');
|
||||
|
||||
return withRandomFileEditor('This will be replaced', (editor, doc) => {
|
||||
const selection = new Selection(
|
||||
new Position(0, 5),
|
||||
new Position(0, 12)
|
||||
);
|
||||
|
||||
return editor.insertSnippet(snippetString, selection).then(inserted => {
|
||||
assert.ok(inserted);
|
||||
assert.equal(doc.getText(), 'This has been replaced');
|
||||
assert.ok(doc.isDirty);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('make edit', () => {
|
||||
return withRandomFileEditor('', (editor, doc) => {
|
||||
return editor.edit((builder) => {
|
||||
|
||||
Reference in New Issue
Block a user