MCPcopy Create free account
hub / github.com/GCWing/BitFun / lsp_format_document

Function lsp_format_document

src/apps/desktop/src/api/lsp_api.rs:333–348  ·  view source on GitHub ↗
(
    request: FormatDocumentRequest,
)

Source from the content-addressed store, hash-verified

331
332#[tauri::command]
333pub async fn lsp_format_document(
334 request: FormatDocumentRequest,
335) -> Result<serde_json::Value, String> {
336 let manager = get_global_lsp_manager().map_err(|e| format!("LSP not initialized: {}", e))?;
337
338 let tab_size = request.tab_size.unwrap_or(4);
339 let insert_spaces = request.insert_spaces.unwrap_or(true);
340
341 let guard = manager.read().await;
342 let edits = guard
343 .format_document(&request.language, &request.uri, tab_size, insert_spaces)
344 .await
345 .map_err(|e| format!("Failed to format document: {}", e))?;
346
347 Ok(edits)
348}
349
350#[tauri::command]
351pub async fn lsp_install_plugin(request: InstallPluginRequest) -> Result<String, String> {

Callers

nothing calls this directly

Calls 3

get_global_lsp_managerFunction · 0.85
readMethod · 0.45
format_documentMethod · 0.45

Tested by

no test coverage detected