mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Clearing WorkingFilesModel should only add file types to recently closed files
Fixes #5997
This commit is contained in:
parent
9cff38ac88
commit
cd1d4d8f55
|
@ -355,14 +355,14 @@ export class WorkingFilesModel implements IWorkingFilesModel {
|
|||
|
||||
// Put the active entry on the top of the stack
|
||||
let input = this.editorService.getActiveEditorInput();
|
||||
let resource: uri = getUntitledOrFileResource(input);
|
||||
let activeResource: uri = getUntitledOrFileResource(input);
|
||||
let activeEntry: WorkingFileEntry;
|
||||
if (resource) {
|
||||
activeEntry = this.findEntry(resource);
|
||||
if (activeResource && activeResource.scheme === 'file') {
|
||||
activeEntry = this.findEntry(activeResource);
|
||||
}
|
||||
|
||||
this.recentlyClosedEntries = this.recentlyClosedEntries.concat(resources.filter(e => {
|
||||
return !activeEntry || e.resource.path !== activeEntry.resource.path;
|
||||
return (!activeEntry || e.resource.path !== activeEntry.resource.path) && e.resource.scheme === 'file';
|
||||
}));
|
||||
|
||||
if (activeEntry) {
|
||||
|
|
|
@ -116,6 +116,21 @@ suite('Files - WorkingFilesModel', () => {
|
|||
assert.equal(model.popLastClosedEntry(), null);
|
||||
});
|
||||
|
||||
test("Clearing the model only adds files to the closed entries", function() {
|
||||
let model = baseInstantiationService.createInstance(WorkingFilesModel);
|
||||
|
||||
model.addEntry(URI.create('untitled', null, '/foo'));
|
||||
assert.equal(model.popLastClosedEntry(), null);
|
||||
model.clear();
|
||||
assert.equal(model.popLastClosedEntry(), null);
|
||||
|
||||
model.addEntry(URI.create('file', null, '/foo'));
|
||||
model.addEntry(URI.create('untitled', null, '/bar'));
|
||||
model.clear();
|
||||
assert.ok(model.popLastClosedEntry().isFile);
|
||||
assert.equal(model.popLastClosedEntry(), null);
|
||||
});
|
||||
|
||||
test("Reopening multiple files will open the editor in the previously opened file", function() {
|
||||
let model = baseInstantiationService.createInstance(WorkingFilesModel);
|
||||
|
||||
|
|
Loading…
Reference in a new issue