diff --git a/src/main.rs b/src/main.rs index 201ed8e..f65c7b0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -257,15 +257,32 @@ impl Completer for DustCompleter { }; 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) { suggestions.push(Suggestion { - value: built_in_value.name().to_string(), - description: Some(built_in_value.description().to_string()), + value: name.to_string(), + description: Some(description.to_string()), extra: None, span: Span::new(pos - last_word.len(), pos), 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() {