1
0
This commit is contained in:
Jeff 2024-01-28 12:14:43 -05:00
parent f67ef7f26f
commit 7b9913309d

View File

@ -257,15 +257,32 @@ impl Completer for DustCompleter {
}; };
for built_in_value in built_in_values() { for built_in_value in built_in_values() {
let name = built_in_value.name();
let description = built_in_value.description();
if built_in_value.name().contains(last_word) { if built_in_value.name().contains(last_word) {
suggestions.push(Suggestion { suggestions.push(Suggestion {
value: built_in_value.name().to_string(), value: name.to_string(),
description: Some(built_in_value.description().to_string()), description: Some(description.to_string()),
extra: None, extra: None,
span: Span::new(pos - last_word.len(), pos), span: Span::new(pos - last_word.len(), pos),
append_whitespace: false, append_whitespace: false,
}); });
} }
if let Value::Map(map) = built_in_value.get() {
for (key, (value, _type)) in map.variables().unwrap().iter() {
if key.contains(last_word) {
suggestions.push(Suggestion {
value: format!("{name}:{key}"),
description: Some(value.to_string()),
extra: None,
span: Span::new(pos - last_word.len(), pos),
append_whitespace: false,
});
}
}
}
} }
for (key, (value, _type)) in self.context.variables().unwrap().iter() { for (key, (value, _type)) in self.context.variables().unwrap().iter() {