roslyn:extract_variable
Extract expressions to local variables in C# code using Roslyn compiler analysis. Refactor code by selecting expressions to create new variables, improving readability and maintainability.
Instructions
Extract an expression to a local variable.
USAGE: Position cursor on or select an expression. OUTPUT: Expression extracted to a new local variable. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to source file | |
| line | Yes | Zero-based line number | |
| column | Yes | Zero-based column number | |
| endLine | No | Optional: end line for selection | |
| endColumn | No | Optional: end column for selection | |
| preview | No | Preview mode (default: true) |