Skip to content

Commit

Permalink
feat: add alternative suggestions for array plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Dec 25, 2022
1 parent 0137a45 commit 1a722ad
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/tailwind-parse/src/eval/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ macro_rules! array_plugin {
.iter()
.find(|&x| x == rest)
.map(|_| to_lit(&[($target, rest)]))
.ok_or_else(|| vec![])
.ok_or_else(|| {
let sort = eddie::Levenshtein::new();
$options
.iter()
.sorted_by_key(|val| sort.distance(rest, val))
.copied()
.take(5)
.collect()
})
}
};
}
Expand Down

0 comments on commit 1a722ad

Please sign in to comment.