Skip to content

Multi-root workspace: always uses first folder; no way to switch active root #5

Description

@FernandoCelmer

Problem

currentWorkspaceFolder() in settings.service.ts always returns vscode.workspace.workspaceFolders?.[0]?.uri.fsPath. In a multi-root workspace this silently pins every pycodeloop serve invocation — and every file-tool jail — to the first folder in the list, regardless of which file the user is editing.

This matters for:

  • The cwd passed to RpcClient (and therefore to the spawned process).
  • The workspace jail that limits read_file/write_file/etc. to one root.
  • resolveWorkspacePath(), which expands ${workspaceFolder} to the same fixed path.

Steps to reproduce / context

  1. Open a multi-root workspace with folders [frontend, backend].
  2. Open the CodeLoop sidebar.
  3. Ask the agent to read a file in backend/.
  4. The agent's working directory is frontend/ and ${workspaceFolder} resolves to frontend/, causing path-not-found errors or the agent reading the wrong tree.

Expected behavior

The extension should either:

  • Follow the active editor's workspace folder (via vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor?.document.uri)), or
  • Expose a command / status-bar picker to let the user select the active root, similar to how the Python extension lets you select the interpreter per-folder.

The chosen root should be re-evaluated (or at least re-queried) each time ensureClient() spawns a new process.

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