diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2023-09-18 20:58:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-18 20:58:16 +0100 |
commit | f5963b6a0595810c0e4b6da793ce0d50a9944796 (patch) | |
tree | e34aeab27179b9270724b101b75107297cb7b03e /cli/util/path.rs | |
parent | 86c04f43e0eda139a262c4f2e106e9b11e8d7da8 (diff) |
refactor(lsp): cleanup document preload (#20520)
Diffstat (limited to 'cli/util/path.rs')
-rw-r--r-- | cli/util/path.rs | 22 |
1 files changed, 0 insertions, 22 deletions
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<ModuleSpecifier, AnyError> { - 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, |