Skip to content

Commit 2a93543

Browse files
committed
fixes
1 parent 0f440b0 commit 2a93543

File tree

4 files changed

+27
-14
lines changed

4 files changed

+27
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"type": "string",
4848
"description": "%python-envs.defaultEnvManager.description%",
4949
"default": "ms-python.python:venv",
50-
"scope": "application"
50+
"scope": "window"
5151
},
5252
"python-envs.defaultPackageManager": {
5353
"type": "string",

src/extension.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { commands, ExtensionContext, LogOutputChannel, Terminal, Uri, window } from 'vscode';
1+
import { commands, ExtensionContext, extensions, LogOutputChannel, Terminal, Uri, window } from 'vscode';
22
import { PythonEnvironment, PythonEnvironmentApi, PythonProjectCreator } from './api';
3+
import { ENVS_EXTENSION_ID } from './common/constants';
34
import { ensureCorrectVersion } from './common/extVersion';
45
import { registerLogger, traceError, traceInfo, traceWarn } from './common/logging';
56
import { clearPersistentState, setPersistentState } from './common/persistentState';
@@ -101,7 +102,10 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
101102

102103
ensureCorrectVersion();
103104

104-
// log extension version
105+
// Log extension version for diagnostics
106+
const extensionVersion = extensions.getExtension(ENVS_EXTENSION_ID)?.packageJSON?.version;
107+
traceInfo(`Python-envs extension version: ${extensionVersion ?? 'unknown'}`);
108+
105109
// log settings
106110
const configLevels = getEnvManagerAndPackageManagerConfigLevels();
107111
traceInfo(`\n=== ${configLevels.section} ===`);

src/managers/common/nativePythonFinder.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,11 @@ function getPythonSettingAndUntildify<T>(name: string, scope?: Uri): T | undefin
669669
/**
670670
* Gets all extra environment search paths from various configuration sources.
671671
* Combines legacy python settings (with migration), globalSearchPaths, and workspaceSearchPaths.
672-
* @returns Array of search directory paths
672+
*
673+
* Paths can include glob patterns which are expanded by the native
674+
* Python Environment Tool (PET) during environment discovery.
675+
*
676+
* @returns Array of search paths (may include glob patterns)
673677
*/
674678
export async function getAllExtraSearchPaths(): Promise<string[]> {
675679
const searchDirectories: string[] = [];
@@ -736,6 +740,7 @@ function getGlobalSearchPaths(): string[] {
736740

737741
/**
738742
* Gets the most specific workspace-level setting available for workspaceSearchPaths.
743+
* Supports glob patterns which are expanded by PET.
739744
*/
740745
function getWorkspaceSearchPaths(): string[] {
741746
try {

src/test/managers/common/nativePythonFinder.getAllExtraSearchPaths.unit.test.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ suite('getAllExtraSearchPaths Integration Tests', () => {
287287
});
288288

289289
test('Workspace folder setting preferred over workspace setting (Windows)', async () => {
290-
// Mock → Workspace settings at different levels (Windows-style)
290+
// Mock → Workspace settings at different levels (Windows-style paths in config)
291291
pythonConfig.get.withArgs('venvPath').returns(undefined);
292292
pythonConfig.get.withArgs('venvFolders').returns(undefined);
293293
envConfig.inspect.withArgs('globalSearchPaths').returns({ globalValue: [] });
@@ -296,8 +296,9 @@ suite('getAllExtraSearchPaths Integration Tests', () => {
296296
workspaceFolderValue: ['C:\\folder-level\\path'],
297297
});
298298

299-
const workspace1 = Uri.file('C:\\Projects\\project1');
300-
const workspace2 = Uri.file('C:\\Projects\\project2');
299+
// Use Unix-style URIs for workspace folders (Uri.file behavior is OS-dependent)
300+
const workspace1 = Uri.file('/projects/project1');
301+
const workspace2 = Uri.file('/projects/project2');
301302
mockGetWorkspaceFolders.returns([{ uri: workspace1 }, { uri: workspace2 }]);
302303

303304
// Run
@@ -381,7 +382,7 @@ suite('getAllExtraSearchPaths Integration Tests', () => {
381382
});
382383

383384
test('Absolute paths used as-is (Windows)', async () => {
384-
// Mock → Mix of absolute paths (Windows-style)
385+
// Mock → Mix of absolute paths (Windows-style paths in config)
385386
pythonConfig.get.withArgs('venvPath').returns(undefined);
386387
pythonConfig.get.withArgs('venvFolders').returns(undefined);
387388
envConfig.inspect.withArgs('globalSearchPaths').returns({
@@ -391,7 +392,8 @@ suite('getAllExtraSearchPaths Integration Tests', () => {
391392
workspaceFolderValue: ['E:\\workspace\\envs'],
392393
});
393394

394-
const workspace = Uri.file('C:\\workspace');
395+
// Use Unix-style URIs for workspace folders (Uri.file behavior is OS-dependent)
396+
const workspace = Uri.file('/workspace');
395397
mockGetWorkspaceFolders.returns([{ uri: workspace }]);
396398

397399
// Run
@@ -520,7 +522,7 @@ suite('getAllExtraSearchPaths Integration Tests', () => {
520522
});
521523

522524
test('Power user - complex mix of all source types (Windows)', async () => {
523-
// Mock → Complex real-world scenario (Windows-style)
525+
// Mock → Complex real-world scenario (Windows-style paths in config)
524526
pythonConfig.get.withArgs('venvPath').returns('C:\\legacy\\venv\\path');
525527
pythonConfig.get.withArgs('venvFolders').returns(['D:\\legacy\\venvs']);
526528
envConfig.inspect.withArgs('globalSearchPaths').returns({
@@ -530,8 +532,9 @@ suite('getAllExtraSearchPaths Integration Tests', () => {
530532
workspaceFolderValue: ['.venv', 'F:\\shared\\team\\envs'],
531533
});
532534

533-
const workspace1 = Uri.file('C:\\workspace\\project1');
534-
const workspace2 = Uri.file('C:\\workspace\\project2');
535+
// Use Unix-style URIs for workspace folders (Uri.file behavior is OS-dependent)
536+
const workspace1 = Uri.file('/workspace/project1');
537+
const workspace2 = Uri.file('/workspace/project2');
535538
mockGetWorkspaceFolders.returns([{ uri: workspace1 }, { uri: workspace2 }]);
536539

537540
// Run
@@ -576,7 +579,7 @@ suite('getAllExtraSearchPaths Integration Tests', () => {
576579
});
577580

578581
test('Overlapping paths are deduplicated (Windows)', async () => {
579-
// Mock → Duplicate paths from different sources (Windows-style)
582+
// Mock → Duplicate paths from different sources (Windows-style paths in config)
580583
pythonConfig.get.withArgs('venvPath').returns(undefined);
581584
pythonConfig.get.withArgs('venvFolders').returns(undefined);
582585
envConfig.inspect.withArgs('globalSearchPaths').returns({
@@ -586,7 +589,8 @@ suite('getAllExtraSearchPaths Integration Tests', () => {
586589
workspaceFolderValue: ['C:\\shared\\path', 'E:\\workspace\\unique'],
587590
});
588591

589-
const workspace = Uri.file('C:\\workspace');
592+
// Use Unix-style URIs for workspace folders (Uri.file behavior is OS-dependent)
593+
const workspace = Uri.file('/workspace');
590594
mockGetWorkspaceFolders.returns([{ uri: workspace }]);
591595

592596
// Run

0 commit comments

Comments
 (0)