less code to care about for #18350

This commit is contained in:
Benjamin Pasero
2017-03-16 17:02:21 +01:00
parent 98d826a29d
commit 06ba86f404
8 changed files with 21 additions and 108 deletions
+2 -1
View File
@@ -10,6 +10,7 @@ import * as fs from 'fs';
import * as platform from 'vs/base/common/platform';
import * as paths from 'vs/base/common/paths';
import { OpenContext } from 'vs/code/common/windows';
import { isParent, isEqual } from 'vs/platform/files/common/files';
/**
* Exported subset of VSCodeWindow for testing.
@@ -46,7 +47,7 @@ export function findBestWindowOrFolder<SimpleWindow extends ISimpleWindow>({ win
}
function findBestWindow<WINDOW extends ISimpleWindow>(windows: WINDOW[], filePath: string): WINDOW {
const containers = windows.filter(window => typeof window.openedWorkspacePath === 'string' && paths.isEqualOrParent(filePath, window.openedWorkspacePath));
const containers = windows.filter(window => typeof window.openedWorkspacePath === 'string' && (isEqual(filePath, window.openedWorkspacePath) || isParent(filePath, window.openedWorkspacePath)));
if (containers.length) {
return containers.sort((a, b) => -(a.openedWorkspacePath.length - b.openedWorkspacePath.length))[0];
}