From 7b9913309d54e8f72ea4ca100cb4950bc98205c7 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sun, 28 Jan 2024 12:14:43 -0500 Subject: [PATCH] Clean up --- src/main.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) 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() {