diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2021-11-23 10:38:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-23 10:38:11 -0500 |
commit | 51e3db956a5927229e3f46f4eaaf317e935f8f17 (patch) | |
tree | 1af79152c7c1edc2c9bc21e8501aad1ba5d7e426 /cli/lsp/completions.rs | |
parent | d8afd5683857de83f3cc80c33322df3d65377210 (diff) |
fix(cli): config file should resolve paths relative to the config file (#12867)
* Add `specifier_to_file_path` to support converting a ModuleSpecifier with a unix-style path to a PathBuf on Windows.
Diffstat (limited to 'cli/lsp/completions.rs')
-rw-r--r-- | cli/lsp/completions.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cli/lsp/completions.rs b/cli/lsp/completions.rs index b23145989..0282bd08c 100644 --- a/cli/lsp/completions.rs +++ b/cli/lsp/completions.rs @@ -5,6 +5,7 @@ use super::lsp_custom; use super::tsc; use crate::fs_util::is_supported_ext; +use crate::fs_util::specifier_to_file_path; use deno_core::normalize_path; use deno_core::resolve_path; @@ -180,7 +181,7 @@ fn get_local_completions( return None; } - let mut base_path = base.to_file_path().ok()?; + let mut base_path = specifier_to_file_path(base).ok()?; base_path.pop(); let mut current_path = normalize_path(base_path.join(current)); // if the current text does not end in a `/` then we are still selecting on @@ -340,7 +341,10 @@ fn relative_specifier( || specifier.port_or_known_default() != base.port_or_known_default() { if specifier.scheme() == "file" { - specifier.to_file_path().unwrap().to_string_lossy().into() + specifier_to_file_path(specifier) + .unwrap() + .to_string_lossy() + .into() } else { specifier.as_str().into() } |