Fixes #20757: Detect overlapping ranges in the extension host, no need to call into renderer process to find out the edits are illegal

This commit is contained in:
Alex Dima
2017-04-27 12:48:28 +02:00
parent 731aee189b
commit 974f8aca31
2 changed files with 65 additions and 17 deletions

View File

@@ -178,4 +178,23 @@ suite('editor tests', () => {
return Promise.resolve();
});
});
test('issue #20757: Overlapping ranges are not allowed!', () => {
return withRandomFileEditor('Hello world!\n\tHello world!', (editor, doc) => {
return editor.edit((builder) => {
// create two edits that overlap (i.e. are illegal)
builder.replace(new Range(0, 0, 0, 2), 'He');
builder.replace(new Range(0, 1, 0, 3), 'el');
}).then(
(applied) => {
assert.ok(false, 'edit with overlapping ranges should fail');
},
(err) => {
assert.ok(true, 'edit with overlapping ranges should fail');
}
);
});
});
});