extract_variable
Extract a selected expression from Java source code into a local variable. Specify expression location with zero-based positions to receive text edits that create the variable and replace the expression.
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 |
|---|---|---|---|
| endLine | Yes | Zero-based end line of expression | |
| startColumn | Yes | Zero-based start column of expression | |
| filePath | Yes | Path to source file | |
| endColumn | Yes | Zero-based end column of expression | |
| variableName | No | Name for the new variable (optional, will suggest if not provided) | |
| startLine | Yes | Zero-based start line of expression |