From f67ef7f26fa99efa10f45bb673cf3c2bc0ce24b6 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sun, 28 Jan 2024 12:07:25 -0500 Subject: [PATCH] Add variable to suggestions --- src/main.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main.rs b/src/main.rs index d705f8e..201ed8e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -268,6 +268,18 @@ impl Completer for DustCompleter { } } + for (key, (value, _type)) in self.context.variables().unwrap().iter() { + if key.contains(last_word) { + suggestions.push(Suggestion { + value: key.to_string(), + description: Some(value.to_string()), + extra: None, + span: Span::new(pos - last_word.len(), pos), + append_whitespace: false, + }); + } + } + suggestions } }