use resourceEditorInput so that virtual documents can be shown in the editor

This commit is contained in:
Johannes Rieken
2016-01-06 17:53:37 +01:00
parent a4874a3997
commit ac5267eb61
2 changed files with 56 additions and 46 deletions

View File

@@ -174,7 +174,29 @@ suite('workspace-namespace', () => {
}, err => {
// expected
})
})
});
test('registerTextDocumentContentProvider, show virtual document', function() {
// duplicate registration
let registration = workspace.registerTextDocumentContentProvider('foo', {
open(uri) {
return 'I am virtual';
},
close() {
// nothing
}
});
return workspace.openTextDocument(Uri.parse('foo://something/path')).then(doc => {
return window.showTextDocument(doc).then(editor => {
assert.ok(editor.document === doc);
assert.equal(editor.document.getText(), 'I am virtual');
registration.dispose();
})
});
});
test('findFiles', () => {
return workspace.findFiles('*.js', null).then((res) => {