Skip to content

Commit

Permalink
feat: add alternative suggestions for simple_lookup_map plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Dec 25, 2022
1 parent 06c043b commit 0137a45
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 @@ -201,7 +201,15 @@ fn simple_lookup_map<'a, V>(
hashmap
.get(search)
.map(|val| to_lit(&[(output, &f(val))]))
.ok_or_else(Vec::new)
.ok_or_else(|| {
let sort = eddie::Levenshtein::new();
hashmap
.keys()
.sorted_by_key(|val| sort.distance(search, val))
.copied()
.take(5)
.collect()
})
}

lookup_plugin_opt!(transition, transition_property, "transitionProperty");
Expand Down

0 comments on commit 0137a45

Please sign in to comment.