Fix: normalize Windows drive letter in VS Code extension webview paths (#1052)

Extract normalizeWindowsDriveLetter to shared pathUtils module

Normalize workspaceFolder to uppercase drive letter to match OpenCode
server's path normalization. This fixes session visibility issues
where VS Code extension sessions don't appear in CLI/desktop and vice
versa due to case-sensitive directory comparison on Windows.

Changes:
- Create pathUtils.ts with shared normalizeWindowsDriveLetter function
- Update opencode.ts to import from pathUtils instead of inline definition
- Update ChatViewProvider.ts, AgentManagerPanelProvider.ts,
  SessionEditorPanelProvider.ts to import from pathUtils
This commit is contained in:
Dolphin
2026-04-27 18:34:50 +03:00
committed by GitHub
parent c83986cd94
commit 25c6e79be7
5 changed files with 28 additions and 14 deletions
+9
View File
@@ -0,0 +1,9 @@
/**
* Normalize Windows drive letter to uppercase.
*
* VS Code's `workspaceFolders[0].uri.fsPath` returns lowercase drive letters (e.g. `d:\...`),
* while process.cwd() (used by OpenCode server) returns uppercase (e.g. `D:\...`).
* Normalize to uppercase so session directory queries match.
*/
export const normalizeWindowsDriveLetter = (p: string): string =>
p.replace(/^([a-z]):/, (_, letter: string) => letter.toUpperCase() + ':');