This adds autocomplete for emoji in the compose box, so e.g. typing :zu offers an autocomplete option of :zulip:.
The first part of the branch makes some refactors to the autocomplete subsystem, in order to prepare to accommodate emoji autocomplete alongside @-mention autocomplete. The changes are all in basically the direction we had in mind when initially building the system; mostly we left some concepts collapsed that we knew we'd eventually need to separate, deferring the details of actually separating them until we had a concrete situation where they came apart.
Fixes: #669
Fixes: #670
Selected commit messages
autocomplete [nfc]: Document how query, view-model, and results classes relate
autocomplete [nfc]: Separate ComposeAutocompleteQuery/Result from Mention-etc.
The two concepts have meant the same set of possible values so far,
because @-mentions are the only type of autocomplete we've had so far
in the compose box's content input. As a result we've taken some
shortcuts by conflating them.
But as we introduce other types of autocomplete in the content input,
like for emoji and #-mentions, we have some places that will need to
refer to the more general concept while others refer to the more
specific one. So separate them out.
emoji [nfc]: Factor out ImageEmojiWidget
emoji [nfc]: Factor out UnicodeEmojiWidget
emoji: Make list of emoji to consider for autocomplete or emoji picker
This leaves the emojiDisplay field of these objects untested. I
skipped that because it seems like pretty boring low-risk code,
just invoking emojiDisplayFor. (And emojiDisplayFor has its own
tests.) But included a TODO comment for completeness in thinking
about what logic there is to test here.
Fixes: #669
autocomplete: Identify when the user intends an emoji autocomplete
The "forbid preceding ':'" wrinkle is one I discovered because of
writing tests: I wrote down the '::^' test, was surprised to find
that it failed, and then went back and extended the regexp to
make it pass.
This adds autocomplete for emoji in the compose box, so e.g. typing
:zu
offers an autocomplete option of:zulip:
.The first part of the branch makes some refactors to the autocomplete subsystem, in order to prepare to accommodate emoji autocomplete alongside @-mention autocomplete. The changes are all in basically the direction we had in mind when initially building the system; mostly we left some concepts collapsed that we knew we'd eventually need to separate, deferring the details of actually separating them until we had a concrete situation where they came apart.
Fixes: #669 Fixes: #670
Selected commit messages
autocomplete [nfc]: Document how query, view-model, and results classes relate
autocomplete [nfc]: Separate ComposeAutocompleteQuery/Result from Mention-etc.
The two concepts have meant the same set of possible values so far, because @-mentions are the only type of autocomplete we've had so far in the compose box's content input. As a result we've taken some shortcuts by conflating them.
But as we introduce other types of autocomplete in the content input, like for emoji and #-mentions, we have some places that will need to refer to the more general concept while others refer to the more specific one. So separate them out.
emoji [nfc]: Factor out ImageEmojiWidget
emoji [nfc]: Factor out UnicodeEmojiWidget
emoji: Make list of emoji to consider for autocomplete or emoji picker
This leaves the emojiDisplay field of these objects untested. I skipped that because it seems like pretty boring low-risk code, just invoking emojiDisplayFor. (And emojiDisplayFor has its own tests.) But included a TODO comment for completeness in thinking about what logic there is to test here.
Fixes: #669
autocomplete: Identify when the user intends an emoji autocomplete
The "forbid preceding ':'" wrinkle is one I discovered because of writing tests: I wrote down the '::^' test, was surprised to find that it failed, and then went back and extended the regexp to make it pass.
[…]
emoji: Finish emoji autocomplete for compose box
Fixes: #670