|
| 1 | +# Diagnostics Integration |
| 2 | + |
| 3 | +Roo Code provides intelligent integration with VSCode's Problems panel, allowing the AI assistant to understand and help fix code errors, warnings, and other issues detected by language servers, linters, and other diagnostic providers. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +The diagnostics feature seamlessly integrates with VSCode's diagnostic system to provide context-aware assistance for code issues. When you make edits or encounter problems in your code, Roo Code can automatically detect and help resolve them. |
| 10 | + |
| 11 | +### Key Capabilities |
| 12 | +- **Automatic Error Detection**: Captures new errors introduced during code edits |
| 13 | +- **Context-Aware Fixes**: Provides targeted fixes based on diagnostic information |
| 14 | +- **Workspace Problems Mention**: Access all workspace diagnostics through a simple mention |
| 15 | +- **Smart Filtering**: Uses predefined severity levels for different contexts |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## Key Features |
| 20 | + |
| 21 | +### 1. Automatic Error Detection |
| 22 | +When Roo Code makes edits to files, it automatically: |
| 23 | +- Captures diagnostics before editing |
| 24 | +- Waits for diagnostics to update after editing |
| 25 | +- Detects new problems introduced by the changes |
| 26 | +- Only reports new errors (not pre-existing ones) |
| 27 | + |
| 28 | +This ensures you're immediately aware of any issues introduced by code changes, allowing for quick resolution. |
| 29 | + |
| 30 | +### 2. Workspace Problems Mention |
| 31 | +Users can include `@problems` in their messages to: |
| 32 | +- Get a complete list of workspace errors and warnings |
| 33 | +- Provide context for debugging tasks |
| 34 | +- Request fixes for specific issues |
| 35 | + |
| 36 | +Example usage: |
| 37 | +``` |
| 38 | +@problems Fix all TypeScript errors in my project |
| 39 | +``` |
| 40 | + |
| 41 | +For more details on using `@problems`, see [Context Mentions](/basic-usage/context-mentions#problems-mention). |
| 42 | + |
| 43 | +### 3. Code Actions Integration |
| 44 | +When diagnostics exist at a cursor position: |
| 45 | +- "Fix with Roo Code" action appears in quick fix menu |
| 46 | +- Includes diagnostic details in the fix request |
| 47 | +- Provides targeted solutions based on error context |
| 48 | + |
| 49 | +Learn more about this integration in [Code Actions](/features/code-actions#context-aware-actions). |
| 50 | + |
| 51 | +### 4. Smart Severity Filtering |
| 52 | +Different features use different severity filters to provide the most relevant information: |
| 53 | +- **Workspace Problems mention**: Shows errors and warnings |
| 54 | +- **Automatic detection**: Shows only errors (to avoid distraction) |
| 55 | +- **Context-Aware**: Different features use different hardcoded severity filters |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +## Severity Levels |
| 60 | + |
| 61 | +The diagnostics system recognizes four severity levels from VSCode: |
| 62 | + |
| 63 | +| Level | Value | Description | Workspace Problems | Auto-detection | |
| 64 | +|-------|-------|-------------|-------------------|----------------| |
| 65 | +| Error | 0 | Syntax errors, type errors, breaking issues | ✅ Included | ✅ Included | |
| 66 | +| Warning | 1 | Code quality issues, deprecations, style violations | ✅ Included | ❌ Not included | |
| 67 | +| Information | 2 | Suggestions, hints, informational messages | ❌ Not included | ❌ Not included | |
| 68 | +| Hint | 3 | Minor suggestions, refactoring opportunities | ❌ Not included | ❌ Not included | |
| 69 | + |
| 70 | +### Why Different Filters? |
| 71 | + |
| 72 | +- **Workspace Problems (`@problems`)**: Includes both errors and warnings to give you a complete picture of code health when explicitly requested |
| 73 | +- **Automatic Detection**: Only includes errors to avoid interrupting your workflow with non-critical issues |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## Using Diagnostics Effectively |
| 78 | + |
| 79 | +### For Debugging Sessions |
| 80 | +When starting a debugging session, include `@problems` to give Roo Code full context: |
| 81 | +``` |
| 82 | +@problems Help me debug why my application is crashing |
| 83 | +``` |
| 84 | + |
| 85 | +### For Code Reviews |
| 86 | +Use diagnostics to ensure code quality: |
| 87 | +``` |
| 88 | +@problems Review my code and fix any linting issues |
| 89 | +``` |
| 90 | + |
| 91 | +### For Refactoring |
| 92 | +Let diagnostics guide safe refactoring: |
| 93 | +``` |
| 94 | +I want to refactor this function. @problems shows current issues to address. |
| 95 | +``` |
| 96 | + |
| 97 | +--- |
| 98 | + |
| 99 | +## Integration with Other Features |
| 100 | + |
| 101 | +### Code Actions |
| 102 | +Diagnostics power the context-aware [Code Actions](/features/code-actions) that appear in VSCode's lightbulb menu. When errors are present, you'll see "Fix Code" options that include the specific diagnostic information. |
| 103 | + |
| 104 | +### Context Mentions |
| 105 | +The [`@problems` mention](/basic-usage/context-mentions#problems-mention) provides a convenient way to include all workspace diagnostics in your conversation without manually copying error messages. |
| 106 | + |
| 107 | +### Automatic Error Reporting |
| 108 | +When Roo Code edits files, any new errors introduced are automatically reported in the response, helping maintain code quality throughout the editing process. |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +## Best Practices |
| 113 | + |
| 114 | +1. **Use `@problems` for Context**: When debugging, always include `@problems` to give Roo Code full visibility into current issues |
| 115 | + |
| 116 | +2. **Address Errors First**: Focus on fixing errors before warnings, as errors typically prevent code from running |
| 117 | + |
| 118 | +3. **Leverage Code Actions**: Use the quick fix menu for targeted fixes to specific diagnostics |
| 119 | + |
| 120 | +4. **Monitor Auto-Detection**: Pay attention to new errors reported after edits to catch issues early |
| 121 | + |
| 122 | +5. **Combine with Other Tools**: Use diagnostics alongside other Roo Code features like codebase search and file mentions for comprehensive problem-solving |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +## Troubleshooting |
| 127 | + |
| 128 | +### Diagnostics Not Appearing |
| 129 | +- Ensure your language server or linter is properly configured and running |
| 130 | +- Check that the file type is supported by your diagnostic providers |
| 131 | +- Verify that VSCode's Problems panel shows the issues |
| 132 | + |
| 133 | +### `@problems` Shows Nothing |
| 134 | +- Confirm there are actually problems in the Problems panel |
| 135 | +- Check that you're in the correct workspace |
| 136 | +- Some diagnostic providers may take time to initialize |
| 137 | + |
| 138 | +### Auto-Detection Missing Errors |
| 139 | +- Only new errors (introduced by edits) are reported |
| 140 | +- Pre-existing errors won't be shown in auto-detection |
| 141 | +- Use `@problems` to see all current issues |
| 142 | + |
| 143 | +--- |
| 144 | + |
| 145 | +## Related Features |
| 146 | + |
| 147 | +- [Context Mentions](/basic-usage/context-mentions) - Learn about all mention types including `@problems` |
| 148 | +- [Code Actions](/features/code-actions) - Discover how diagnostics integrate with quick fixes |
| 149 | +- [Codebase Search](/features/codebase-indexing) - Find code related to specific errors |
0 commit comments