Skip to content

Conversation

@MuriloFP
Copy link
Contributor

@MuriloFP MuriloFP commented Jul 4, 2025

Related GitHub Issue

Closes: #5149

Roo Code Task Context (Optional)

Description

This PR reimplements the functionality from the outdated PR #5343 to add a configurable maximum number of codebase search results. The implementation adds a slider control in the Experimental Settings section that allows users to adjust the maximum number of search results returned by the codebase indexing feature (range: 10-1000).

Key implementation details:

  • Added maxSearchResults field to the codebase index configuration schema with proper validation
  • Implemented a new updateCodebaseIndexConfig message handler to properly merge configuration updates
  • Created a slider UI component in the Experimental Settings section with real-time updates
  • Added comprehensive i18n support for all 18 supported languages
  • Fixed a critical persistence bug where the property name mismatch (config vs codebaseIndexConfig) prevented settings from saving

Design choices:

  • Used a slider control for better UX when selecting numeric values within a range
  • Implemented proper state management to ensure settings persist across VS Code sessions
  • Added debouncing to prevent excessive API calls during slider adjustments

Test Procedure

Automated Testing:

  • All existing tests pass, including the new test for updateCodebaseIndexConfig in config-manager.spec.ts
  • Run tests with: cd src && npx vitest services/code-index/__tests__/config-manager.spec.ts

Manual Testing Steps:

  1. Open VS Code with the extension installed
  2. Navigate to Settings (Cmd/Ctrl + ,)
  3. Search for "Roo Code" or navigate to Extensions > Roo Code
  4. Expand the "Experimental Settings" section
  5. Adjust the "Max Search Results" slider
  6. Verify the value updates in real-time
  7. Close and reopen VS Code
  8. Navigate back to the settings and verify the value persisted
  9. Test edge cases: minimum value (10), maximum value (1000), and various intermediate values

Verification of i18n:

  • Change VS Code language settings to any supported language
  • Verify the label and description text are properly translated

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

Before: No configurable option for maximum search results

After: New slider control in Experimental Settings
Max Search Results Slider

Documentation Updates

  • No documentation updates are required.
  • Yes, documentation updates are required. The user documentation should be updated to mention the new configurable maximum search results option in the Experimental Settings section, including:
    • How to access the setting
    • The valid range (10-200)
    • The default value (50)
    • How this affects codebase search performance and results

Additional Notes

This PR addresses a long-standing feature request to make the codebase search results limit configurable. The original PR #5343 became outdated due to significant codebase changes. This reimplementation maintains the same functionality while adapting to the current codebase structure.

The persistence bug fix was critical - without it, the setting would reset on every VS Code restart. The issue was traced to a property name mismatch in the message payload between frontend and backend.

Get in Touch

Discord: @MuriloFP

Credits to @SannidhyaSah for the original PR and implementation.


Important

This PR adds a configurable maximum search results feature to the codebase indexing settings, with UI updates, backend handling, and internationalization support.

  • Behavior:
    • Adds codebaseIndexSearchMaxResults to codebaseIndexConfigSchema in codebase-index.ts with validation for range 10-200.
    • Implements updateCodebaseIndexConfig handler in webviewMessageHandler.ts to merge configuration updates.
    • Updates search() in qdrant-client.ts to use maxResults parameter.
  • UI:
    • Adds a slider for "Max Search Results" in ExperimentalSettings.tsx with real-time updates.
    • Supports reset to default value (50) and debouncing to reduce API calls.
  • Testing:
    • Adds tests for updateCodebaseIndexConfig in webviewMessageHandler.spec.ts and config-manager.spec.ts.
    • Adds UI tests in ExperimentalSettings.spec.tsx.
  • Internationalization:
    • Updates i18n files for 18 languages to include new slider labels and descriptions.

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

@MuriloFP MuriloFP requested review from cte, jr and mrubens as code owners July 4, 2025 21:23
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. documentation Improvements or additions to documentation enhancement New feature or request labels Jul 4, 2025
@MuriloFP MuriloFP marked this pull request as draft July 4, 2025 21:25
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 4, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code Roadmap Jul 4, 2025
@MuriloFP MuriloFP marked this pull request as ready for review July 4, 2025 22:16
@dosubot dosubot bot added the UI/UX UI/UX related or focused label Jul 4, 2025
@daniel-lxs daniel-lxs moved this from PR [Draft / In Progress] to PR [Needs Prelim Review] in Roo Code Roadmap Jul 4, 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 Jul 4, 2025
MuriloFP and others added 4 commits July 4, 2025 17:57
…odeInc#5149)

- Add codebaseIndexSearchMaxResults to configuration schema with validation (10-1000)
- Update Qdrant client to accept maxResults parameter in search method
- Add UI slider in Experimental Settings to configure max search results
- Rename constants to DEFAULT_MAX_SEARCH_RESULTS and DEFAULT_SEARCH_MIN_SCORE for clarity
- Add translations for new setting across all 17 supported languages
- Add comprehensive test coverage for config manager, Qdrant client, and UI components

fix: settings persistence for codebase index configuration

- Add new updateCodebaseIndexConfig message type to properly merge config updates
- Update SettingsView to send entire codebaseIndexConfig object instead of just enabled flag
- Add backend handler to merge configuration updates instead of overwriting
- Add tests for the new message handler functionality

This ensures the max search results setting persists correctly when saved.
The frontend was sending 'config' but the backend expects 'codebaseIndexConfig'.
This mismatch was preventing the max search results setting from persisting.
@daniel-lxs daniel-lxs force-pushed the feat/issue-5149-configurable-max-search-results branch from fda1594 to b836def Compare July 4, 2025 23:41
daniel-lxs and others added 2 commits July 4, 2025 18:55
…esults into saveCodeIndexSettingsAtomic

- Removed updateCodebaseIndexConfig message type and handler as per PR feedback
- Added codebaseIndexSearchMaxResults to codeIndexSettings type in WebviewMessage.ts
- Updated saveCodeIndexSettingsAtomic to save codebaseIndexSearchMaxResults
- Fixed SettingsView.tsx to use codebaseIndexEnabled message instead of updateCodebaseIndexConfig
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Jul 5, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 5, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Jul 5, 2025
@mrubens mrubens merged commit 4a78f51 into RooCodeInc:main Jul 5, 2025
14 checks passed
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jul 5, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request lgtm This PR has been approved by a maintainer PR - Needs Preliminary Review size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add configurable maximum search results setting for codebase indexing

4 participants