From f5963b6a0595810c0e4b6da793ce0d50a9944796 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Mon, 18 Sep 2023 20:58:16 +0100 Subject: refactor(lsp): cleanup document preload (#20520) --- cli/util/path.rs | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'cli/util') diff --git a/cli/util/path.rs b/cli/util/path.rs index c15a1ede1..4aadf6583 100644 --- a/cli/util/path.rs +++ b/cli/util/path.rs @@ -122,28 +122,6 @@ pub fn specifier_to_file_path( } } -/// Attempts to convert a file path to a specifier. By default, uses the Url -/// crate's `from_file_path()` method, but falls back to try and resolve -/// unix-style paths on Windows. -pub fn specifier_from_file_path( - path: &Path, -) -> Result { - if cfg!(windows) { - match ModuleSpecifier::from_file_path(path) { - Ok(url) => Ok(url), - Err(()) => { - let mut url = ModuleSpecifier::parse("file:///").unwrap(); - url.set_path(&path.to_string_lossy()); - Ok(url) - } - } - } else { - ModuleSpecifier::from_file_path(path).map_err(|()| { - uri_error(format!("Invalid file path.\n Path: {}", path.display())) - }) - } -} - /// `from.make_relative(to)` but with fixes. pub fn relative_specifier( from: &ModuleSpecifier, -- cgit v1.2.3