Skip to content

Add proper multi-root workspace support #14

Description

@dollfins

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

  1. diagnostics.ts:runGuard() — uses workspaceFolders[0] as cwd
  2. diagnostics.ts:shouldScan() — uses workspaceFolders[0] for relative path calculation
  3. 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

  • Files in any workspace folder are scanned correctly
  • CLI runs with the correct workspace folder as cwd
  • Exclude patterns apply relative to each folder's root
  • Workspace scan processes all folders
  • No breaking changes for single-folder workspaces

Complexity

High — requires careful refactoring of how workspace context is passed through the diagnostic pipeline.

Points

200

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions