Add icons to the search-items

When I search in (for example search query in sqlx), many of the search items have same names. And it's hard to locate the right one I want.

How about to add icons to indicate their symbol types?

Icons for Rust from Dash


Symbol types are indicated by color already. I feel like an icon would just clutter the view in most cases, but maybe it can be an option (useful for color-blind people, for example)

Symbols may be easier to learn and recognize. I, for one, can't remember what the color scheme is (— other than "structs are purple") so I just see "these are different from those" when viewing search results.

But of course there is no symbol that standardly means "struct" or "trait" so they would still have to be learned.


Maybe it doesn't have to be an icon, it could just be the word struct or trait or enum...


This is a good point, and as other folks have mentioned above, while color is important, is usually not enough. This could be a good opportunity to use both icon and color, for example, see how Xcode differentiates between Swift symbols:


The icon could show its description when hovering over it, this can help with discoverability and getting familiar with them.

1 Like

Those icons are just a letter in a colored shape. I'm not sure it's very different from a keyword in colored letters, except for horizontal space, which is at less of a premium in doc search results compared to an IDE sidebar.


An icon that is a letter in a shape still has some advantages over text. In particular, it would be a constant width, making it easier to scan the list of paths;

struct foo::db::Query
fn foo::db::query

would be misaligned making it harder to see that the second path shares a prefix with the first, but

[S] foo::db::Query
[F] foo::db::query

maintains vertical alignment.

Also, it is very common that icons are a finite set (here, provided by rustdoc) and text is arbitrary content (here, paths of items) — so using icons helps visually communicate “if you want to read what is new information in this particular document, read the text and not the icons; the icons are just additional context”.

A lot of modern UI design has, in my opinion, too many cryptic low-detail icons where you have to discover what they are by tooltip or experiment. But in this case, I think icons would a nice enhancement; they would let me more reliably scan the list of search results for the kind of thing I want (e.g. a function and not a module or struct). As I mentioned previously, the colors are hard to remember, and also, they're scattered horizontally depending on the path length. Color variation in a single column would be easier to skim.


It could also be a table, so that the idents are aligned, with the highlighted keywords right-aligned in their column, like

struct foo::db::Query
    fn foo::db::query
  enum foo::db::SortOrder