Be smarter about auto-complete of @ mentions
Problem to solve
In an issue thread, when replying to a previous commenter, it's common to @ mention them. When a user starts typing
@, we populate a list of auto-complete candidates. We're supposedly smart about prioritizing that list, but in practice, it fails often. Let's be smarter about populating that list. For example, prioritizing previous people in the same thread or issue.
For example, in https://gitlab.com/gitlab-org/gitlab/issues/169, I'm replying to a specific person, and after typing the person's name,
Tom, auto-complete doesn't even list the right Tom in the list, showing 5 other Toms instead.
Presumably it's confused because the person's first name doesn't appear in their username at all, so if we're prioritizing usernames only, then we actually hide the relevant person. I suggest we should be looking at both display name and username when considering auto-complete responses.
It's even weirder before I start typing as it shows some seemingly random people at the top of the list, with the last entry being the actual person I want to reach. How did we determine that list? It's got the second last commenter, but not the last commenter? Edit: Looks like those "random" people actually did participate in the thread. It's not all of them, and not even the first 5, but it skews towards the earlier commenters. Perhaps we could improve it by including the most recent commenters as that's more likely the target of a response?
Sorting by most recent commenter would likely solve my needs at least. But I'd also say that once you start typing, you shouldn't then throw away that knowledge. The resulting filtered results should still be sorted by those recently participating in the issue, matching display name and username.
- Sort list by most-recent comment
- When typing, filter by display name as well as username
- When typing, keep sorting list by most-recent comment, followed by non-commenters
- Consider showing more than 5 entries.
Side note, if you are going to limit to 5 entries, at least set the size of the popup to match all 5 entries. Showing a scrollbar just to see the last few pixels of the last entry is a waste, and also misleads the viewer into thinking there are more than 5 entries with the (misguided) hope that the entry they're looking for might be down there.