Roo-Code/pr-body.md
Roo Code 86c6af14bd fix: resolve vscode module import issue in webview build
- Separate vscode-dependent code into vscode-utils.ts
- Create wrapper module to conditionally use vscode functionality
- Update all imports to use the wrapper instead of direct imports
- Initialize vscode utilities during extension activation
- This prevents the webview build from failing due to vscode module not being available in browser context
2025-08-05 11:48:22 +00:00

1.7 KiB

Summary

This PR fixes issue #6720 where Roo Code incorrectly identifies the .roo folder location in multi-root workspaces. When .roo is added as one of the workspace folders, it should be recognized directly rather than being treated as a subdirectory of another workspace folder.

Problem

In multi-root workspaces, when .roo is added as a workspace folder, Roo Code was still creating/looking for .roo as a subdirectory of the first workspace folder instead of recognizing the existing .roo workspace folder.

Solution

  • Added findWorkspaceWithRoo() utility function to detect when .roo is one of the workspace folders
  • Updated getProjectRooDirectoryForCwd() to return the .roo workspace folder path directly when it exists
  • Updated all direct .roo path constructions throughout the codebase to use the centralized utility functions
  • Added comprehensive tests for multi-root workspace scenarios

Changes

  • src/services/roo-config/index.ts: Added findWorkspaceWithRoo() and updated getProjectRooDirectoryForCwd()
  • src/core/webview/webviewMessageHandler.ts: Updated to use getProjectRooDirectoryForCwd()
  • src/services/mcp/McpHub.ts: Updated to use getProjectRooDirectoryForCwd()
  • src/services/marketplace/SimpleInstaller.ts: Updated to use getProjectRooDirectoryForCwd()
  • src/core/config/CustomModesManager.ts: Updated to use getProjectRooDirectoryForCwd()
  • src/services/roo-config/tests/index.spec.ts: Added tests for the new functionality

Testing

  • Added unit tests for findWorkspaceWithRoo() function
  • Added tests for getProjectRooDirectoryForCwd() with multi-root workspace scenarios
  • All existing tests pass without regression
  • Manually tested in VS Code with multi-root workspaces

Fixes #6720