format_range
Get formatting edits for a selected code range via LSP. Returns TextEdit[] for the specified lines or characters without applying them, ideal for formatting a function or block instead of the whole file.
Instructions
Get formatting edits for a specific range within a document via LSP (textDocument/rangeFormatting). Returns TextEdit[] for the selected lines/characters only. Use this when you want to format a function, block, or selection rather than the entire file. The edits are NOT applied automatically.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file_path": "<file_path>",
"start_line": "<start_line>",
"start_column": "<start_column>",
"end_line": "<end_line>",
"end_column": "<end_column>"
},
"name": "format_range"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end_line | Yes | ||
| tab_size | No | ||
| file_path | Yes | ||
| end_column | Yes | ||
| start_line | Yes | ||
| language_id | No | ||
| start_column | Yes | ||
| insert_spaces | No |