diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-11-24 17:35:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-24 17:35:33 -0500 |
commit | 60b5d32d902deb46f640cbdb0d2d4caf47a437c4 (patch) | |
tree | d3d315d5a1c34d7f350f22c083c3d67410ad18e8 /cli/lsp/completions.rs | |
parent | 6f02fa1abf6bd42975b75f1777dcde748ee662af (diff) |
fix(lsp): handle byonm specifiers in jupyter notebooks (#21332)
Part of https://github.com/denoland/deno/issues/21308
Diffstat (limited to 'cli/lsp/completions.rs')
-rw-r--r-- | cli/lsp/completions.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/cli/lsp/completions.rs b/cli/lsp/completions.rs index 2b528b010..246659ab1 100644 --- a/cli/lsp/completions.rs +++ b/cli/lsp/completions.rs @@ -3,7 +3,6 @@ use super::client::Client; use super::config::ConfigSnapshot; use super::config::WorkspaceSettings; -use super::documents::file_like_to_file_specifier; use super::documents::Documents; use super::documents::DocumentsFilter; use super::lsp_custom; @@ -375,16 +374,11 @@ fn get_local_completions( current: &str, range: &lsp::Range, ) -> Option<Vec<lsp::CompletionItem>> { - let base = match file_like_to_file_specifier(base) { - Some(s) => s, - None => base.clone(), - }; - if base.scheme() != "file" { return None; } - let mut base_path = specifier_to_file_path(&base).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 @@ -404,10 +398,10 @@ fn get_local_completions( let de = de.ok()?; let label = de.path().file_name()?.to_string_lossy().to_string(); let entry_specifier = resolve_path(de.path().to_str()?, &cwd).ok()?; - if entry_specifier == base { + if entry_specifier == *base { return None; } - let full_text = relative_specifier(&base, &entry_specifier)?; + let full_text = relative_specifier(base, &entry_specifier)?; // this weeds out situations where we are browsing in the parent, but // we want to filter out non-matches when the completion is manually // invoked by the user, but still allows for things like `../src/../` |