Apply code review suggestions

including filling in gaps in emoji shortcode coverage.

Signed-off-by: Robin Townsend <robin@robin.town>
This commit is contained in:
Robin Townsend 2021-07-19 15:09:15 -04:00
parent c1ed023e17
commit f8a922eaa1
5 changed files with 21 additions and 21 deletions

View file

@ -49,7 +49,7 @@ const EMOJI_SHORTCODES: IEmojiShort[] = EMOJI.sort((a, b) => {
emoji,
// Include the index so that we can preserve the original order
_orderBy: index,
})).filter(o => o.emoji.shortcodes[0]);
}));
function score(query, space) {
const index = space.indexOf(query);
@ -68,7 +68,7 @@ export default class EmojiProvider extends AutocompleteProvider {
super(EMOJI_REGEX);
this.matcher = new QueryMatcher<IEmojiShort>(EMOJI_SHORTCODES, {
keys: ['emoji.emoticon'],
funcs: [o => o.emoji.shortcodes.map(s => `:${s}:`).join(" ")],
funcs: [o => o.emoji.shortcodes.map(s => `:${s}:`)],
// For matching against ascii equivalents
shouldMatchWordsOnly: false,
});