summaryrefslogtreecommitdiff
path: root/cli/lsp/completions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/lsp/completions.rs')
-rw-r--r--cli/lsp/completions.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/cli/lsp/completions.rs b/cli/lsp/completions.rs
index 94111fee8..c6fc6216e 100644
--- a/cli/lsp/completions.rs
+++ b/cli/lsp/completions.rs
@@ -2,6 +2,7 @@
use super::client::Client;
use super::config::ConfigSnapshot;
+use super::documents::cell_to_file_specifier;
use super::documents::Documents;
use super::documents::DocumentsFilter;
use super::lsp_custom;
@@ -364,11 +365,16 @@ fn get_local_completions(
current: &str,
range: &lsp::Range,
) -> Option<Vec<lsp::CompletionItem>> {
+ let base = match cell_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
@@ -388,10 +394,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/../`