diff --git a/src/tsconfig.strictNullChecks.json b/src/tsconfig.strictNullChecks.json index d31d9b6ecd2d1..51a1f4d7baa55 100644 --- a/src/tsconfig.strictNullChecks.json +++ b/src/tsconfig.strictNullChecks.json @@ -194,6 +194,7 @@ "./vs/code/node/wait.ts", "./vs/code/node/windowsFinder.ts", "./vs/code/test/node/argv.test.ts", + "./vs/code/test/node/windowsFinder.test.ts", "./vs/editor/contrib/bracketMatching/bracketMatching.ts", "./vs/editor/contrib/bracketMatching/test/bracketMatching.test.ts", "./vs/editor/contrib/caretOperations/caretOperations.ts", diff --git a/src/vs/code/node/windowsFinder.ts b/src/vs/code/node/windowsFinder.ts index 8541b69dbe562..4c1765657dee0 100644 --- a/src/vs/code/node/windowsFinder.ts +++ b/src/vs/code/node/windowsFinder.ts @@ -26,7 +26,7 @@ export interface IBestWindowOrFolderOptions { fileUri?: URI; userHome?: string; codeSettingsFolder?: string; - workspaceResolver: (workspace: IWorkspaceIdentifier) => IResolvedWorkspace; + workspaceResolver: (workspace: IWorkspaceIdentifier) => IResolvedWorkspace | null; } export function findBestWindowOrFolderForFile({ windows, newWindow, reuseWindow, context, fileUri, workspaceResolver }: IBestWindowOrFolderOptions): W | null { @@ -39,7 +39,7 @@ export function findBestWindowOrFolderForFile({ windows return !newWindow ? getLastActiveWindow(windows) : null; } -function findWindowOnFilePath(windows: W[], fileUri: URI, workspaceResolver: (workspace: IWorkspaceIdentifier) => IResolvedWorkspace): W | null { +function findWindowOnFilePath(windows: W[], fileUri: URI, workspaceResolver: (workspace: IWorkspaceIdentifier) => IResolvedWorkspace | null): W | null { // First check for windows with workspaces that have a parent folder of the provided path opened const workspaceWindows = windows.filter(window => !!window.openedWorkspace); diff --git a/src/vs/code/test/node/windowsFinder.test.ts b/src/vs/code/test/node/windowsFinder.test.ts index 0c04c5b2cf544..bd9e7ee187afb 100644 --- a/src/vs/code/test/node/windowsFinder.test.ts +++ b/src/vs/code/test/node/windowsFinder.test.ts @@ -31,7 +31,7 @@ function options(custom?: Partial>): I } const vscodeFolderWindow: ISimpleWindow = { lastFocusTime: 1, openedFolderUri: URI.file(path.join(fixturesFolder, 'vscode_folder')) }; -const lastActiveWindow: ISimpleWindow = { lastFocusTime: 3, openedFolderUri: null }; +const lastActiveWindow: ISimpleWindow = { lastFocusTime: 3, openedFolderUri: undefined }; const noVscodeFolderWindow: ISimpleWindow = { lastFocusTime: 2, openedFolderUri: URI.file(path.join(fixturesFolder, 'no_vscode_folder')) }; const windows: ISimpleWindow[] = [ vscodeFolderWindow,