Added substring search for asset path autocomplete

This commit is contained in:
Syniis 2024-02-26 20:49:40 +01:00 committed by Isse
parent 646c1ea4ba
commit d9c9a671ed
No known key found for this signature in database

View File

@ -597,6 +597,13 @@ impl TabComplete for ArgumentSpec {
.map(|c| c.to_string())
.collect(),
ArgumentSpec::AssetPath(_, prefix, paths, _) => {
if let Some(part_stripped) = part.strip_prefix('#') {
paths
.iter()
.filter(|string| string.contains(part_stripped))
.filter_map(|c| Some(c.strip_prefix(prefix)?.to_string()))
.collect()
} else {
let part_with_prefix = prefix.to_string() + part;
let depth = part_with_prefix.split('.').count();
paths
@ -606,6 +613,7 @@ impl TabComplete for ArgumentSpec {
.filter(|string| string.starts_with(&part_with_prefix))
.filter_map(|c| Some(c.strip_prefix(prefix)?.to_string()))
.collect()
}
},
ArgumentSpec::Boolean(_, part, _) => ["true", "false"]
.iter()