From 5614ef1675d54aec9dd18db6570e3704b409361d Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Mon, 19 Jul 2021 21:52:32 -0400 Subject: [PATCH] Rename some variables since their purpose has changed Signed-off-by: Robin Townsend --- src/autocomplete/EmojiProvider.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/autocomplete/EmojiProvider.tsx b/src/autocomplete/EmojiProvider.tsx index 7cd784d71c..d3175edbdb 100644 --- a/src/autocomplete/EmojiProvider.tsx +++ b/src/autocomplete/EmojiProvider.tsx @@ -35,12 +35,12 @@ const LIMIT = 20; // anchored to only match from the start of parts otherwise it'll show emoji suggestions whilst typing matrix IDs const EMOJI_REGEX = new RegExp('(' + EMOTICON_REGEX.source + '|(?:^|\\s):[+-\\w]*:?)$', 'g'); -interface IEmojiShort { +interface ISortedEmoji { emoji: IEmoji; _orderBy: number; } -const EMOJI_SHORTCODES: IEmojiShort[] = EMOJI.sort((a, b) => { +const SORTED_EMOJI: ISortedEmoji[] = EMOJI.sort((a, b) => { if (a.group === b.group) { return a.order - b.order; } @@ -61,18 +61,18 @@ function score(query, space) { } export default class EmojiProvider extends AutocompleteProvider { - matcher: QueryMatcher; - nameMatcher: QueryMatcher; + matcher: QueryMatcher; + nameMatcher: QueryMatcher; constructor() { super(EMOJI_REGEX); - this.matcher = new QueryMatcher(EMOJI_SHORTCODES, { + this.matcher = new QueryMatcher(SORTED_EMOJI, { keys: ['emoji.emoticon'], funcs: [o => o.emoji.shortcodes.map(s => `:${s}:`)], // For matching against ascii equivalents shouldMatchWordsOnly: false, }); - this.nameMatcher = new QueryMatcher(EMOJI_SHORTCODES, { + this.nameMatcher = new QueryMatcher(SORTED_EMOJI, { keys: ['emoji.annotation'], // For removing punctuation shouldMatchWordsOnly: true,