load_document_from_disk

Function load_document_from_disk 

Source
pub async fn load_document_from_disk(uri: &Uri) -> Result<String>
Expand description

Loads document content from disk.

§Arguments

  • uri - Document URI (must be file:// scheme)

§Returns

  • Ok(String) - File content
  • Err(DepsError) - File not found, permission denied, or not a file URI

§Errors

  • DepsError::InvalidUri - URI is not a file:// URI
  • DepsError::Io - File read error (not found, permission denied, etc.)

§Examples

use deps_lsp::document::load_document_from_disk;
use tower_lsp_server::ls_types::Uri;

let uri = Uri::from_file_path("/path/to/Cargo.toml").unwrap();
let content = load_document_from_disk(&uri).await?;
println!("Loaded {} bytes", content.len());