Skip to content

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Sep 12, 2025

Fixes #7926

Summary

This PR adds a workspace-level toggle to enable/disable codebase indexing per folder, accessible from the settings pop-up below the chatbox.

Changes

  • Added workspace-specific indexing settings that override global settings
  • Implemented UI toggle in CodeIndexPopover for workspace-level control
  • Store workspace settings using VSCode workspace state API
  • Support multi-root workspaces with per-folder settings
  • Added comprehensive unit tests for new functionality
  • Updated translations for new UI elements

How it works

  • On first open of a workspace, it inherits the current global indexing value
  • Users can toggle indexing on/off for specific workspaces via the settings popover
  • Workspace settings override global settings when explicitly set
  • Settings persist across VSCode sessions using workspace state

Testing

  • All existing tests pass
  • Added new test suite for workspace-level toggle functionality
  • Type checks pass
  • Linting passes

Screenshots

The new workspace toggle appears in the Code Index settings popover when indexing is enabled globally.


Important

Adds a workspace-level toggle for codebase indexing, allowing per-workspace control and persistence across sessions, with comprehensive UI and backend support.

  • Behavior:
    • Adds workspace-level toggle for codebase indexing in CodeIndexPopover.tsx.
    • Workspace settings override global settings when explicitly set.
    • Settings persist across VSCode sessions using workspace state.
  • Configuration:
    • Updates CodeIndexConfigManager to manage workspace-specific settings.
    • Adds workspaceIndexEnabled to codebaseIndexConfigSchema in codebase-index.ts.
  • UI:
    • Implements UI toggle in CodeIndexPopover.tsx for workspace-level control.
    • Updates translations in settings.json for new UI elements.
  • Testing:
    • Adds workspace-indexing-toggle.spec.ts for unit tests of new functionality.
    • Updates manager.spec.ts to test integration with CodeIndexManager.

This description was created by Ellipsis for b887bd2. You can customize this summary. It will automatically update as commits are pushed.

- Add workspace-specific indexing settings that override global settings
- Implement UI toggle in CodeIndexPopover for workspace-level control
- Store workspace settings using VSCode workspace state API
- Support multi-root workspaces with per-folder settings
- Add comprehensive unit tests for new functionality
- Update translations for new UI elements

Fixes #7926
@roomote roomote bot requested review from mrubens, cte and jr as code owners September 12, 2025 06:00
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request UI/UX UI/UX related or focused labels Sep 12, 2025
if (this.context) {
// Use a hash of the workspace path as the key to avoid issues with special characters
const key = `codebaseIndexEnabled_${Buffer.from(workspacePath).toString("base64")}`
await this.context.workspaceState.update(key, enabled)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good implementation of workspace-specific settings. Consider adding a try/catch block around the context.workspaceState.update call (line 529) to log or handle potential errors during saving.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 12, 2025
Copy link
Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing my own code is like debugging in a mirror - everything looks backwards but somehow still broken.

<div className="mb-4 ml-6">
<div className="flex items-center gap-2">
<VSCodeCheckbox
checked={currentSettings.workspaceIndexEnabled !== false}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workspace toggle condition currentSettings.workspaceIndexEnabled !== false could be more explicit about handling the three-state logic (true/false/undefined). When undefined, it inherits the global setting, but this implicit behavior might be confusing. Consider using a more explicit check for clearer intent.

return this.workspaceIndexEnabled.get(workspacePath)
}
// Use a hash of the workspace path as the key to avoid issues with special characters
const key = `codebaseIndexEnabled_${Buffer.from(workspacePath).toString("base64")}`
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base64 encoding logic for workspace paths is duplicated here and on line 530. Consider extracting to a private helper method:

private getWorkspaceStateKey(workspacePath: string): string {
  return `codebaseIndexEnabled_${Buffer.from(workspacePath).toString("base64")}`;
}

This would improve maintainability and ensure consistency.

@@ -480,4 +501,57 @@
public get currentSearchMaxResults(): number {
return this.searchMaxResults ?? DEFAULT_MAX_SEARCH_RESULTS
}

/**
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new workspace-specific methods would benefit from more detailed JSDoc comments explaining:

  • The base64 encoding strategy for workspace paths
  • The inheritance model (undefined = inherit global)
  • How this interacts with multi-root workspaces

This would help future maintainers understand the design decisions.

// Initialize config manager with mocks
configManager = new CodeIndexConfigManager(mockContextProxy, testWorkspacePath, mockContext)
})

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding edge case tests for workspace paths with special characters (spaces, unicode, etc.) to ensure the base64 encoding handles them correctly. This would increase confidence in the robustness of the implementation.

@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Sep 12, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR - Needs Preliminary Review size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused
Projects
Status: PR [Needs Prelim Review]
Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Workspace toggle to enable/disable codebase indexing per folder
2 participants