lsp_format_document
Format source code documents using Language Server Protocol to apply consistent styling based on project-specific settings, supporting multiple programming languages.
Instructions
Format a document using the language server's formatting capabilities. Respects project-specific formatting settings.
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>"
},
"name": "lsp_format_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Absolute path to the source file to format | |
| tab_size | No | Number of spaces per tab (default: 2) | |
| insert_spaces | No | Use spaces instead of tabs (default: true) | |
| apply | No | If true, apply formatting changes to file. If false, return edits without applying. |