extract_variable
Extract an expression selected by zero-based coordinates into a local variable, returning the necessary text edits for declaration and replacement.
Instructions
Extract an expression at the given position into a local variable.
Returns the text edits needed to extract the expression. The caller should apply these edits to perform the extraction.
USAGE: Select expression by providing start and end positions OUTPUT: Variable declaration and replacement edits
IMPORTANT: Uses ZERO-BASED coordinates.
Requires load_project to be called first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Path to source file | |
| startColumn | Yes | Zero-based start column of expression | |
| endLine | Yes | Zero-based end line of expression | |
| startLine | Yes | Zero-based start line of expression | |
| variableName | No | Name for the new variable (optional, will suggest if not provided) | |
| endColumn | Yes | Zero-based end column of expression |