extract_constant
Extract Java expressions into static final constants at class level using zero-based coordinates to generate text edits for code refactoring.
Instructions
Extract an expression into a static final constant at class level.
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: Constant declaration and replacement edits
IMPORTANT: Uses ZERO-BASED coordinates.
Requires load_project to be called first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| constantName | Yes | Name for the constant (should be UPPER_SNAKE_CASE) | |
| 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 |