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.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/cli/lsp/completions.rs b/cli/lsp/completions.rs
index d459daee0..7f11daef2 100644
--- a/cli/lsp/completions.rs
+++ b/cli/lsp/completions.rs
@@ -10,7 +10,7 @@ use super::npm::NpmSearchApi;
use super::registries::ModuleRegistry;
use super::tsc;
-use crate::util::path::is_supported_ext;
+use crate::util::path::is_importable_ext;
use crate::util::path::relative_specifier;
use crate::util::path::specifier_to_file_path;
@@ -420,7 +420,7 @@ fn get_local_completions(
..Default::default()
}),
Ok(file_type) if file_type.is_file() => {
- if is_supported_ext(&de.path()) {
+ if is_importable_ext(&de.path()) {
Some(lsp::CompletionItem {
label,
kind: Some(lsp::CompletionItemKind::FILE),
@@ -743,6 +743,8 @@ mod tests {
std::fs::write(file_e, b"").expect("could not create");
let file_f = dir_a.join("f.mjs");
std::fs::write(file_f, b"").expect("could not create");
+ let file_g = dir_a.join("g.json");
+ std::fs::write(file_g, b"").expect("could not create");
let specifier =
ModuleSpecifier::from_file_path(file_c).expect("could not create");
let actual = get_local_completions(
@@ -761,13 +763,12 @@ mod tests {
);
assert!(actual.is_some());
let actual = actual.unwrap();
- assert_eq!(actual.len(), 2);
+ assert_eq!(actual.len(), 3);
for item in actual {
match item.text_edit {
Some(lsp::CompletionTextEdit::Edit(text_edit)) => {
- assert!(
- text_edit.new_text == "./f.mjs" || text_edit.new_text == "./b"
- );
+ assert!(["./b", "./f.mjs", "./g.json"]
+ .contains(&text_edit.new_text.as_str()));
}
_ => unreachable!(),
}