extract_variable
Extract Java expressions into local variables by specifying code positions, generating text edits for refactoring. Requires project loading first.
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 |
|---|---|---|---|
| variableName | No | Name for the new variable (optional, will suggest if not provided) | |
| endColumn | Yes | Zero-based end column of expression | |
| 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 |