roslyn:apply_code_fix
List, preview, and apply automated code fixes for diagnostics like CS0168 using zero-based coordinates. Preview changes before applying to disk.
Instructions
Apply automated code fix for a diagnostic. WORKFLOW: (1) Call with no fixIndex to list available fixes, (2) Call with fixIndex and preview=true to preview changes, (3) Call with preview=false to apply. IMPORTANT: Uses ZERO-BASED coordinates.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | Yes | Zero-based line number (editor line - 1) | |
| column | Yes | Zero-based column number (editor column - 1) | |
| preview | No | Preview mode (default: true). Set to false to apply changes to disk. ALWAYS preview first! | |
| filePath | Yes | Absolute path to source file | |
| fixIndex | No | Index of fix to apply (omit to list available fixes). Call without this parameter first to see available fixes. | |
| diagnosticId | Yes | Diagnostic ID (e.g., CS0168, CS1998, CS4012) |