Repository navigation
Description
Problem
getWorkspacePath() in src/extension.ts resolves the workspace like this:
function getWorkspacePath(): string | undefined {
const workspaceFolders = vscode.workspace.workspaceFolders;
if (!workspaceFolders || workspaceFolders.length === 0) {
vscode.window.showErrorMessage('No workspace folder open');
return undefined;
}
return workspaceFolders[0].uri.fsPath;
}
Only the first folder of a multi-root workspace is ever considered. In a .code-workspace with several folders, everything outside folder[0] is unreachable by any WinApp command — there is no prompt, no setting, and no error explaining why the app isn't found.
Two things make it worse:
winapp.appDirectoriescan't route around it.isContainedInWorkspace()insrc/project-resolver.tsrejects absolute paths and..traversal, so the setting cannot point at a second root even when the user knows exactly where their app is.winapp.appDirectorieshas no"scope"declared inpackage.json, so it defaults towindow— a single value for the whole workspace rather than per-folder.vscode/settings.jsonvalues.
Meanwhile WinAppDebugAdapterFactory uses session.workspaceFolder, which is folder-scoped — so F5 and the command palette can silently operate on different roots.
Affected commands
Every project-context command routed through resolveProjectDirectory:
- WinApp: Initialize Project
- WinApp: Restore Packages
- WinApp: Update Packages
- WinApp: Generate Manifest
- WinApp: Update Manifest Assets
- WinApp: Add Manifest Execution Alias
- WinApp: Generate Certificate
- WinApp: Unregister Package
- WinApp: Get WinApp Path
Relationship to the winapp run project-mode work
The project-mode change makes winapp.run, winapp.runAdvanced, and the debug adapter multi-root aware, and deliberately leaves the general-purpose primitives behind for reuse:
getWorkspaceRoots()and per-root scan/aggregate helpers- root labelling for QuickPick items (applied only when more than one root exists, so single-folder users see no change)
- active-editor-root defaulting
So this issue should be a rewiring rather than a rewrite: point resolveProjectDirectory's dependencies at those helpers.
Scope
- Make
resolveProjectDirectoryspan all workspace roots, reusing the primitives above. - Replace
getWorkspacePath()'s folder[0] assumption for the remaining commands. - Declare
winapp.appDirectoriesas"scope": "resource"and makeisContainedInWorkspacevalidate per-root, so each folder's.vscode/settings.jsoncan supply its own app directories. - Extend the existing
src/test/project-resolver.test.tscoverage to multi-root cases.
Activity