Description
The extension currently assumes a single workspace root folder. Several places use workspaceFolders?.[0] which will silently use the first folder only in multi-root workspaces, potentially scanning the wrong project.
Affected Code
diagnostics.ts:runGuard() — uses workspaceFolders[0] as cwd
diagnostics.ts:shouldScan() — uses workspaceFolders[0] for relative path calculation
diagnostics.ts:scanWorkspace() — iterates folders but only uses folder-local file discovery (this part is actually correct already)
Expected Behavior
When scanning a file, determine which workspace folder it belongs to and use that folder's root for:
- The CLI working directory (
cwd)
- Relative path computation for exclude pattern matching
For workspace scanning, each folder should be scanned independently with results aggregated per-folder.
Implementation Notes
- Use
vscode.workspace.getWorkspaceFolder(uri) to determine the correct folder for a given file
- Pass the workspace folder to
runGuard() instead of always using [0]
- Consider showing per-folder scores in the report panel
- Update
SorobanGuardConfig to support per-folder settings (optional, stretch goal)
Acceptance Criteria
Complexity
High — requires careful refactoring of how workspace context is passed through the diagnostic pipeline.
Points
200
Description
The extension currently assumes a single workspace root folder. Several places use
workspaceFolders?.[0]which will silently use the first folder only in multi-root workspaces, potentially scanning the wrong project.Affected Code
diagnostics.ts:runGuard()— usesworkspaceFolders[0]ascwddiagnostics.ts:shouldScan()— usesworkspaceFolders[0]for relative path calculationdiagnostics.ts:scanWorkspace()— iterates folders but only uses folder-local file discovery (this part is actually correct already)Expected Behavior
When scanning a file, determine which workspace folder it belongs to and use that folder's root for:
cwd)For workspace scanning, each folder should be scanned independently with results aggregated per-folder.
Implementation Notes
vscode.workspace.getWorkspaceFolder(uri)to determine the correct folder for a given filerunGuard()instead of always using[0]SorobanGuardConfigto support per-folder settings (optional, stretch goal)Acceptance Criteria
Complexity
High — requires careful refactoring of how workspace context is passed through the diagnostic pipeline.
Points
200