-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: Add settings to control diagnostic messages (#5524) #5582
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
✅ No security or compliance issues detected. Reviewed everything up to deb6ef4. Security Overview
Detected Code ChangesThe diff is too large to display a summary of code changes. Reply to this PR with |
- Standardize default max diagnostic messages to 50 across all files - Extract diagnostic settings to centralized constants and helper functions - Add comprehensive documentation for diagnostic settings - Update UI to always show max diagnostic messages slider - Add unit tests for ContextManagementSettings component - Improve code organization and maintainability
73f5a27
to
c9ebec1
Compare
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.
Pull Request Overview
This PR adds user-configurable settings to control the inclusion and quantity of diagnostic messages (errors/warnings) in AI context, diff views, and @problems
mentions.
- Introduces two new settings:
•includeDiagnosticMessages
(boolean toggle)
•maxDiagnosticMessages
(numeric limit, 0 for unlimited) - Integrates settings end-to-end: global schema, VSCode webview UI, message handling, state persistence, and diagnostic processing.
- Updates translations for all supported locales and adds comprehensive unit tests.
Reviewed Changes
Copilot reviewed 47 out of 47 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
webview-ui/src/i18n/locales/.../settings.json | Add translation keys/values for the new diagnostic settings |
webview-ui/src/context/ExtensionStateContext.tsx | Extend extension state context with diagnostic settings fields |
webview-ui/src/components/settings/ContextManagementSettings.tsx | Add checkbox, slider, and reset button for diagnostic settings |
webview-ui/src/components/settings/tests/ContextManagementSettings.spec.tsx | Update UI tests to cover new diagnostic controls |
src/integrations/diagnostics/index.ts | Modify diagnosticsToProblemsString to respect new settings |
src/integrations/diagnostics/tests/diagnostics.spec.ts | Add tests for filtering and limiting diagnostics |
src/core/webview/webviewMessageHandler.ts | Handle saving/restoring diagnostic settings via messages |
src/core/webview/ClineProvider.ts | Persist diagnostic settings in the provider’s state |
packages/types/src/global-settings.ts | Add new fields to the global settings schema |
Comments suppressed due to low confidence (2)
src/integrations/diagnostics/index.ts:149
- [nitpick] Stat-ing and opening each document inside the loop can be costly. Consider caching file stats and opened TextDocuments to reduce repeated I/O operations.
fileStat = await vscode.workspace.fs.stat(uri)
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.
Thank you @copilot and @ellipsis-dev for the thorough review! I've addressed all the issues you identified:
- ✅ Fixed the zh-TW translation typo (duplicate '預' character)
- ✅ Fixed the Hindi translation typo (incorrect Punjabi character 'ਹੈ' replaced with Hindi 'है')
- ✅ Fixed the inconsistent default value in webviewMessageHandler.ts (changed from 100 to 50)
- ✅ Removed the unused 'diagnosticCount' variable and its increment statement
Regarding the code duplication suggestion - I appreciate the feedback! While there is some duplication between the limited and unlimited diagnostic processing blocks, I've decided to leave this refactoring for a future PR to keep this one focused on the diagnostic settings feature.
All changes have been committed in deb6ef4.
needs changes outlined in 4860 |
- Description now updates in real-time as slider value changes - Shows appropriate context level (minimal, moderate, comprehensive) based on threshold - Improves user understanding of diagnostic context settings
- Remove dynamic description based on slider position - Always show comprehensive description explaining all diagnostic levels - Ensures users understand full range of options regardless of current setting
- Replace hardcoded 'Unlimited' text with proper translation key - Remove unused 'unlimitedDescription' translation keys from all 18 language files - Ensures consistent localization across all supported languages
- Remove getDiagnosticSettings() helper function and constants file - Update DiffViewProvider to accept Task instance for direct state access - Remove updateDiagnosticSettings method from DiffViewProvider - Update all tools to access diagnostic settings directly from state - Add ARIA labels to diagnostic messages slider for accessibility - Add integration tests for diagnostic settings functionality - Use inline defaults instead of separate constants file
- Fix typo in zh-TW translation (duplicate '預' character) - Fix typo in Hindi translation (incorrect character 'ਹੈ' to 'है') - Fix inconsistent default value in webviewMessageHandler.ts (100 to 50) - Remove unused 'diagnosticCount' variable in diagnostics/index.ts
- Changed from count-based to size-based limiting to prevent context overflow - Each unit of maxDiagnosticMessages now represents ~1KB of content - Complete diagnostics are included up to the size limit - Clear indication of omitted problems when limit is reached - Updated tests to reflect new behavior - Updated UI description to explain the new approach
…cks correctly - Added role='combobox' to Select mock to fix accessibility test failures - Fixed checkbox assertions to target the input element instead of the wrapper - Added keyboard event handling to Slider mock for arrow key interactions - All 31 tests now pass successfully
- Modified diagnosticsToProblemsString() to limit by message count instead of content size - Updated UI description to accurately reflect count-based limiting - Updated tests to verify count-based limiting works correctly - When maxDiagnosticMessages is set to 1, it now shows exactly 1 diagnostic message
- Fix default value from 5 to 50 in ClineProvider.ts and tests - Fix translation inconsistencies in Hindi and Turkish locales - Move diagnostics delay setting from Auto-Approve to Context Management section
8f906fc
to
9019ffe
Compare
- Restored ${webview.cspSource} to connect-src directive in HMR HTML content - Restored ${webview.cspSource} to connect-src directive in production HTML content - These changes were unrelated to the diagnostic settings feature
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.
LGTM
Related GitHub Issue
Closes: #5524
Closes: #4860
Roo Code Task Context (Optional)
N/A
Description
This PR implements two new global settings to control diagnostic messages (linting errors, warnings) that appear in diff views and
@problems
mentions:includeDiagnosticMessages
(boolean): Toggle to enable/disable the inclusion of diagnostic messages entirelymaxDiagnosticMessages
(number): Limit the number of diagnostic messages included (0 = unlimited)Key Implementation Details:
Design Choices:
@problems
mentionsTest Procedure
Automated Tests:
src/integrations/diagnostics/__tests__/diagnostics.spec.ts
webview-ui/src/components/settings/__tests__/ContextManagementSettings.spec.tsx
Manual Testing Steps:
@problems
mentions@problems
mention and verify it respects the settingsVerification Results:
npm test
)npm run build
)npm run lint
)Pre-Submission Checklist
Screenshots / Videos
Note: Screenshots need to be added manually showing:
@problems
mentionDocumentation Updates
@problems
mentionsAdditional Notes
This feature addresses a common pain point where projects with many linting errors can overwhelm the AI with diagnostic messages, leading to less focused responses. The implementation is backward compatible and provides users with fine-grained control over their AI interactions.
Get in Touch
Important
Add settings to control diagnostic messages, allowing toggling and limiting, with UI integration and tests.
includeDiagnosticMessages
andmaxDiagnosticMessages
toglobal-settings.ts
.ContextManagementSettings.tsx
andClineProvider.ts
.diagnostics.spec.ts
andContextManagementSettings.spec.tsx
.index.ts
andTask.ts
to respect new settings.This description was created by
for 6e6c9c4. You can customize this summary. It will automatically update as commits are pushed.