Skip to content

Commit 1b2d498

Browse files
authored
Fix interpreter fetching for untitled files (#17515)
* Fix interpreter fetching for untitled files * Just use untitled files
1 parent f23ffc9 commit 1b2d498

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/client/pythonEnvironments/legacyIOC.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,14 @@ class ComponentAdapter implements IComponentAdapter {
301301
let wsFolder: vscode.WorkspaceFolder | undefined;
302302
if (resource !== undefined) {
303303
wsFolder = vscode.workspace.getWorkspaceFolder(resource);
304-
} else if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) {
304+
}
305+
// Untitled files should still use the workspace as the query location
306+
if (
307+
!wsFolder &&
308+
vscode.workspace.workspaceFolders &&
309+
vscode.workspace.workspaceFolders.length > 0 &&
310+
(!resource || resource.scheme === 'untitled')
311+
) {
305312
[wsFolder] = vscode.workspace.workspaceFolders;
306313
}
307314

0 commit comments

Comments
 (0)