Skip to content

Commit bc0a76c

Browse files
committed
windows yay
1 parent 733f005 commit bc0a76c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.github/instructions/generic.instructions.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ Provide project context and coding guidelines that AI should follow when generat
3535

3636
**CRITICAL**: This extension runs on Windows, macOS, and Linux. NEVER hardcode POSIX-style paths.
3737

38+
- Use `path.join()` or `path.resolve()` instead of string concatenation with `/`
39+
- Use `Uri.file(path).fsPath` when comparing paths (Windows uses `\`, POSIX uses `/`)
40+
- When asserting path equality, compare `fsPath` to `fsPath`, not raw strings
41+
3842
## Learnings
3943

4044
- When using `getConfiguration().inspect()`, always pass a scope/Uri to `getConfiguration(section, scope)` — otherwise `workspaceFolderValue` will be `undefined` because VS Code doesn't know which folder to inspect (1)
45+
- **path.normalize() vs path.resolve()**: On Windows, `path.normalize('\test')` keeps it as `\test`, but `path.resolve('\test')` adds the current drive → `C:\test`. When comparing paths, use `path.resolve()` on BOTH sides or they won't match (2)

src/features/interpreterSelection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ function getProjectSpecificEnvManager(projectManager: PythonProjectManager, scop
358358
const pw = projectManager.get(scope);
359359
const w = getWorkspaceFolder(scope);
360360
if (pw && w) {
361-
const pwPath = path.normalize(pw.uri.fsPath);
361+
const pwPath = path.resolve(pw.uri.fsPath);
362362
const matching = overrides.find((s) => path.resolve(w.uri.fsPath, s.path) === pwPath);
363363
if (matching && matching.envManager && matching.envManager.length > 0) {
364364
return matching.envManager;

0 commit comments

Comments
 (0)