Skip to main content

handle_format

Function handle_format 

Source
pub async fn handle_format(
    path: &Path,
    client: &mut LspClient,
    file_tracker: &mut FileTracker,
    project_root: &Path,
) -> Result<Value>
Expand description

Format a file using the LSP textDocument/formatting request.

Re-opens the file to ensure the LSP has fresh on-disk content, then applies the returned TextEdit list atomically.

ยงErrors

Returns an error if the LSP request fails or the file cannot be written.