mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-17 05:41:07 +01:00
less code to care about for #18350
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user