Rebrand to Galaxy, major improvements to Bedrock support, still needs some TLC though

This commit is contained in:
Ryan Ward
2026-05-07 11:29:34 -05:00
parent f4e2475c60
commit a41cbd8cc7
2433 changed files with 14208 additions and 9409 deletions
@@ -0,0 +1,43 @@
use std::collections::HashSet;
use crate::completer::{
matchers::MatchStrategy,
suggest::{MatchedSuggestion, Priority, Suggestion, SuggestionType},
};
use crate::parsers::ParsedToken;
use itertools::Itertools;
use smol_str::SmolStr;
pub fn suggestions(
matcher: MatchStrategy,
env_vars: &HashSet<SmolStr>,
parsed_token: &ParsedToken,
) -> Vec<MatchedSuggestion> {
let var_to_complete = parsed_token;
if !var_to_complete.as_str().starts_with('$') {
return Default::default();
}
let var_to_complete = &var_to_complete.as_str()[1..];
env_vars
.iter()
.filter_map(|name| {
matcher
.get_match_type(var_to_complete, name)
.map(|match_type| {
let suggestion_text = format!("${name}");
let suggestion = Suggestion::with_same_display_and_replacement(
suggestion_text,
None,
SuggestionType::Variable,
Priority::default(),
);
MatchedSuggestion::new(suggestion, match_type)
})
})
.sorted_by(MatchedSuggestion::cmp_by_display)
.collect()
}