|
| 1 | +# Task: Generate VS Code Diagnostic API Reference Documentation |
| 2 | + |
| 3 | +## Objective |
| 4 | + |
| 5 | +Generate comprehensive API reference documentation for the **VS Code Diagnostic API**. The Diagnostic API allows extensions to report code issues (errors, warnings, information, hints) to users within the editor. |
| 6 | + |
| 7 | +## Scope |
| 8 | + |
| 9 | +Your documentation should cover the following API surface within the `vscode.languages` namespace: |
| 10 | + |
| 11 | +### Core Interfaces and Classes |
| 12 | + |
| 13 | +1. **Diagnostic class**: Represents a single diagnostic (error, warning, info, hint) |
| 14 | +2. **DiagnosticCollection interface**: Container for managing diagnostics across documents |
| 15 | +3. **DiagnosticSeverity enum**: Severity levels (Error, Warning, Information, Hint) |
| 16 | +4. **DiagnosticRelatedInformation class**: Additional context for diagnostics |
| 17 | +5. **DiagnosticTag enum**: Tags for categorizing diagnostics (Unnecessary, Deprecated) |
| 18 | + |
| 19 | +### Key Functions |
| 20 | + |
| 21 | +1. **createDiagnosticCollection()**: Factory function for creating diagnostic collections |
| 22 | +2. **getDiagnostics()**: Retrieve diagnostics for a resource or workspace |
| 23 | + |
| 24 | +### Events |
| 25 | + |
| 26 | +1. **onDidChangeDiagnostics**: Event fired when diagnostics change globally |
| 27 | + |
| 28 | +## Required Content |
| 29 | + |
| 30 | +Your API reference must include: |
| 31 | + |
| 32 | +### For Each API Method/Function: |
| 33 | +- **Signature**: Full TypeScript signature with parameter types and return type |
| 34 | +- **Parameters**: Description of each parameter, including optional/required status |
| 35 | +- **Return value**: Description of what is returned |
| 36 | +- **Behavior notes**: How the API behaves in different scenarios |
| 37 | +- **Error cases**: What errors can occur and when |
| 38 | + |
| 39 | +### For Each Interface/Class: |
| 40 | +- **Properties**: All properties with types and descriptions |
| 41 | +- **Methods**: All methods with signatures and behavior |
| 42 | +- **Constructor**: Construction pattern (if applicable) |
| 43 | +- **Lifecycle**: Object lifecycle and disposal semantics |
| 44 | + |
| 45 | +### Usage Examples: |
| 46 | +- **Basic usage**: Simple diagnostic creation and publishing |
| 47 | +- **Advanced patterns**: Event subscription, cleanup, related information |
| 48 | +- **Real-world patterns**: Extract usage examples from internal VS Code code |
| 49 | + |
| 50 | +## Output Format |
| 51 | + |
| 52 | +Write your documentation to `/workspace/documentation.md` using Markdown format. |
| 53 | + |
| 54 | +Structure your documentation as follows: |
| 55 | + |
| 56 | +```markdown |
| 57 | +# VS Code Diagnostic API Reference |
| 58 | + |
| 59 | +## Overview |
| 60 | +[Brief introduction to the Diagnostic API] |
| 61 | + |
| 62 | +## Core Types |
| 63 | + |
| 64 | +### Diagnostic |
| 65 | +[Class documentation] |
| 66 | + |
| 67 | +### DiagnosticCollection |
| 68 | +[Interface documentation] |
| 69 | + |
| 70 | +### DiagnosticSeverity |
| 71 | +[Enum documentation] |
| 72 | + |
| 73 | +### DiagnosticRelatedInformation |
| 74 | +[Class documentation] |
| 75 | + |
| 76 | +### DiagnosticTag |
| 77 | +[Enum documentation] |
| 78 | + |
| 79 | +## Functions |
| 80 | + |
| 81 | +### createDiagnosticCollection() |
| 82 | +[Function documentation] |
| 83 | + |
| 84 | +### getDiagnostics() |
| 85 | +[Function documentation] |
| 86 | + |
| 87 | +## Events |
| 88 | + |
| 89 | +### onDidChangeDiagnostics |
| 90 | +[Event documentation] |
| 91 | + |
| 92 | +## Usage Examples |
| 93 | + |
| 94 | +### Basic Example |
| 95 | +[Code example with explanation] |
| 96 | + |
| 97 | +### Advanced Example |
| 98 | +[Code example with explanation] |
| 99 | + |
| 100 | +## Common Patterns |
| 101 | +[Patterns discovered from internal usage] |
| 102 | + |
| 103 | +## Error Handling |
| 104 | +[Error cases and handling strategies] |
| 105 | +``` |
| 106 | + |
| 107 | +## Tips |
| 108 | + |
| 109 | +- Use the VS Code repository's TypeScript definitions (src/vs/vscode.d.ts) to find exact API signatures |
| 110 | +- Search for internal usage in src/vs/workbench/ and extensions/ directories to discover real-world patterns |
| 111 | +- Include behavioral notes that aren't obvious from type signatures (e.g., disposal requirements, threading considerations) |
| 112 | +- Document the relationship between DiagnosticCollection.set() and getDiagnostics() |
| 113 | +- Explain when onDidChangeDiagnostics fires and what information it provides |
| 114 | + |
| 115 | +## Evaluation |
| 116 | + |
| 117 | +Your documentation will be scored on: |
| 118 | +- **API completeness** (40%): Coverage of all required API methods, properties, and types |
| 119 | +- **Behavioral notes** (30%): Correct description of non-obvious behaviors, lifecycle, error cases |
| 120 | +- **Usage examples** (20%): Quality and correctness of code examples from internal callers |
| 121 | +- **Structure** (10%): Organization, clarity, and completeness of documentation structure |
0 commit comments