Skip to main content

uri_to_path

Function uri_to_path 

Source
pub fn uri_to_path(uri: &Uri) -> Option<PathBuf>
Expand description

Convert a filesystem path to a file:// URI in the form LSP expects. lsp-types 0.97 dropped the url crate; we percent-encode manually for the small set of bytes that matter in a path (space → %20, etc.). Servers in practice tolerate plain file:///<path> without aggressive encoding. Inverse of uri_from_path. Strips the file:// scheme + percent-decodes the small set of bytes the encoder rewrites. Returns the path string (caller decides whether to coerce to PathBuf); None for non-file:// URIs.