Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hatoo committed Feb 17, 2024
1 parent 7ffb65b commit 5fbc61a
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/src_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,11 +468,12 @@ impl SrcTree {
.collect();
}
}
Vec::new()
} else if node.parent().map(|p| p.kind()) == Some("variant") || is_inner(node, "schema") {
// complete types
let global_types = self.global_types();

return global_types
global_types
.iter()
.map(|s| s.as_str())
.chain(BUILTIN_TYPES.iter().copied())
Expand All @@ -481,20 +482,20 @@ impl SrcTree {
kind: Some(CompletionItemKind::CLASS),
..Default::default()
})
.collect();
.collect()
} else if node.prev_sibling().is_some() {
// Triggered by space
// Completion global variables
let globals = self.globals_all();
return globals
globals
.iter()
.map(|s| s.as_str())
.map(|s| CompletionItem {
label: s.to_string(),
kind: Some(CompletionItemKind::FUNCTION),
..Default::default()
})
.collect();
.collect()
} else if is_root_command(node) {
// Completion keywords
const KEYWORDS: &[&str] = &[
Expand Down Expand Up @@ -534,7 +535,7 @@ impl SrcTree {

let globals = self.globals_all();

return KEYWORDS
KEYWORDS
.iter()
.map(|k| CompletionItem {
label: k.to_string(),
Expand All @@ -546,10 +547,10 @@ impl SrcTree {
kind: Some(CompletionItemKind::FUNCTION),
..Default::default()
}))
.collect();
.collect()
} else {
let globals = self.globals_all();
return globals
globals
.iter()
.map(|s| s.as_str())
.chain(BUILTIN.iter().copied())
Expand All @@ -563,10 +564,8 @@ impl SrcTree {
kind: Some(CompletionItemKind::VARIABLE),
..Default::default()
}))
.collect();
.collect()
}

Vec::new()
}

pub fn includes(&self) -> Vec<String> {
Expand Down

0 comments on commit 5fbc61a

Please sign in to comment.