Skip to content

Commit

Permalink
removeFromRecentlyOpened Command Broken. Fixes #58131
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli committed Sep 11, 2018
1 parent 120fe2e commit e6d95f4
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/vs/platform/history/electron-main/historyMainService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class HistoryMainService implements IHistoryMainService {
const mru = this.getRecentlyOpened();
let update = false;

pathsToRemove.forEach((pathToRemove => {
pathsToRemove.forEach(pathToRemove => {

// Remove workspace
let index = arrays.firstIndex(mru.workspaces, workspace => {
Expand All @@ -132,7 +132,7 @@ export class HistoryMainService implements IHistoryMainService {
}
if (typeof pathToRemove === 'string') {
if (isSingleFolderWorkspaceIdentifier(workspace)) {
return workspace.scheme === Schemas.file && areResourcesEqual(URI.file(pathToRemove), workspace);
return workspace.scheme === Schemas.file && isEqual(pathToRemove, workspace.fsPath, !isLinux /* ignorecase */);
}
if (isWorkspaceIdentifier(workspace)) {
return isEqual(pathToRemove, workspace.configPath, !isLinux /* ignorecase */);
Expand All @@ -146,15 +146,20 @@ export class HistoryMainService implements IHistoryMainService {
}

// Remove file
const pathToRemoveURI = pathToRemove instanceof URI ? pathToRemove : typeof pathToRemove === 'string' ? URI.file(pathToRemove) : null;
if (pathToRemoveURI) {
index = arrays.firstIndex(mru.files, file => areResourcesEqual(file, pathToRemoveURI));
}
index = arrays.firstIndex(mru.files, file => {
if (pathToRemove instanceof URI) {
return areResourcesEqual(file, pathToRemove);
} else if (typeof pathToRemove === 'string') {
return isEqual(file.fsPath, pathToRemove, !isLinux /* ignorecase */);
}
return false;
});

if (index >= 0) {
mru.files.splice(index, 1);
update = true;
}
}));
});

if (update) {
this.saveRecentlyOpened(mru);
Expand Down

0 comments on commit e6d95f4

Please sign in to comment.