-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: improve multi-folder workspace support #6898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Fix Task to store initial workspace folder and use it consistently throughout task lifetime - Fix file mentions to use relative paths in multi-folder workspaces - Fix .roo folder detection to check if .roo is a workspace folder itself - Add support for workspace folder selection based on active editor - Add tests for multi-folder workspace functionality Fixes #6897 and #6720
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed my own code and found bugs I didn't know I was capable of writing.
| if (workspaceFolder) { | ||
| // Use relative path from the workspace folder | ||
| const relativePath = path.relative(workspaceFolder.uri.fsPath, absPath) | ||
| displayPath = path.join(workspaceFolder.name, relativePath).toPosix() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is .toPosix() an extension method defined elsewhere? I don't see it in standard JavaScript/TypeScript. This could cause runtime errors. Consider using path.posix.join() or creating a utility function to normalize paths consistently.
| const projectMcpPattern = new vscode.RelativePattern(workspaceFolder, ".roo/mcp.json") | ||
| this.projectMcpWatcher = vscode.workspace.createFileSystemWatcher(projectMcpPattern) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice multiple file watchers are created in the loop but only the last one gets stored in this.projectMcpWatcher. Could this lead to memory leaks since the earlier watchers won't be properly disposed? Consider storing all watchers or refactoring this logic.
| let roomodesPath: string | ||
| if (rooWorkspaceFolder) { | ||
| // .roo is a workspace folder itself, look for .roomodes directly in it | ||
| roomodesPath = path.join(rooWorkspaceFolder.uri.fsPath, ROOMODES_FILENAME.replace(".roo/", "")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This replace operation doesn't seem to do anything since ROOMODES_FILENAME is defined as .roomodes not .roo/roomodes. Was this intended for a different purpose?
|
Closing, the author will be implementing this |
This PR improves support for multi-folder workspaces in Roo Code, addressing issues #6897 and #6720.
Changes
1. Fixed Task workspace path consistency
Taskclass to store the initial workspace folder when created2. Improved file mention handling
backend/src/server.tsinstead of/absolute/path/to/backend/src/server.ts)3. Fixed .roo folder detection
.roois itself a workspace folder.roofolders in multi-folder setups.roofolder to use4. Added comprehensive tests
Testing
Fixes
Impact
These changes ensure that Roo Code works seamlessly in multi-folder workspaces, preventing confusion when switching between different folders and maintaining consistent context throughout tasks.
Important
Enhances multi-folder workspace support in Roo Code by ensuring consistent task workspace paths, converting file mentions to relative paths, and improving .roo folder detection, with comprehensive tests added.
Taskclass now stores initial workspace folder on creation, ensuring consistent workspace path throughout task lifetime.index.ts..rooas a workspace folder inCustomModesManager.ts,webviewMessageHandler.ts, andMcpHub.ts..roofolder usage.multi-folder-workspace.spec.tsfor multi-folder workspace functionality.This description was created by
for 27a05f8. You can customize this summary. It will automatically update as commits are pushed.