From 25e9c51dbd473ceec2da70781e01ad7ddfb2fbce Mon Sep 17 00:00:00 2001 From: Kai Schmidt Date: Tue, 24 Sep 2024 15:01:38 -0700 Subject: [PATCH] sort named function dropdown differently --- site/src/editor/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/site/src/editor/mod.rs b/site/src/editor/mod.rs index 4f50917f9..9b3045994 100644 --- a/site/src/editor/mod.rs +++ b/site/src/editor/mod.rs @@ -1137,7 +1137,10 @@ pub fn Editor<'a>( let mut named_prims: Vec = Primitive::non_deprecated() .filter(|prim| prim.glyph().is_none()) .collect(); - named_prims.sort_by_key(|prim| prim.name().trim_start_matches("&")); + named_prims.sort_by(|a, b| { + (a.name().starts_with('&').cmp(&b.name().starts_with('&'))) + .then_with(|| a.name().cmp(b.name())) + }); let max_name_len = named_prims .iter() .map(|prim| prim.name().chars().count())