mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 10:08:49 +01:00
Add API to open a file or diff editor on a specific selection range (fixes #30241)
This commit is contained in:
@@ -260,6 +260,19 @@ suite('workspace-namespace', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('openTextDocument, with selection', function () {
|
||||
return createRandomFile('foo\nbar\nbar').then(file => {
|
||||
return vscode.workspace.openTextDocument(file).then(doc => {
|
||||
return vscode.window.showTextDocument(doc, { selection: new vscode.Range(new vscode.Position(1, 1), new vscode.Position(1, 2)) }).then(editor => {
|
||||
assert.equal(editor.selection.start.line, 1);
|
||||
assert.equal(editor.selection.start.character, 1);
|
||||
assert.equal(editor.selection.end.line, 1);
|
||||
assert.equal(editor.selection.end.character, 2);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('registerTextDocumentContentProvider, simple', function () {
|
||||
|
||||
let registration = vscode.workspace.registerTextDocumentContentProvider('foo', {
|
||||
|
||||
Reference in New Issue
Block a user