-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for searching by tag, description #47
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,8 +40,7 @@ export default class EmojiCompletionProvider implements vscode.CompletionItemPro | |
return this.getMarkupEmojiCompletions(document, replacementSpan); | ||
} | ||
|
||
return this.getUnicodeEmojiCompletions(document, replacementSpan) | ||
.concat(this.getMarkupEmojiCompletions(document, replacementSpan)); | ||
return this.getUnicodeEmojiCompletions(document, replacementSpan); | ||
} | ||
|
||
private getUnicodeEmojiCompletions( | ||
|
@@ -54,9 +53,15 @@ export default class EmojiCompletionProvider implements vscode.CompletionItemPro | |
|
||
const kind = vscode.CompletionItemKind.Text; | ||
return this.emojiProvider.emojis.map((x) => { | ||
const item = new vscode.CompletionItem(`:${x.name}: ${x.emoji}`, kind); | ||
item.filterText = `:${x.name}:`; | ||
item.documentation = new vscode.MarkdownString(`# ${x.emoji}`); | ||
const item = new vscode.CompletionItem({ | ||
label: `:${x.name}: ${x.emoji}`, | ||
description: x.tags.join(', '), | ||
}, kind); | ||
item.filterText = `:${x.name} ${x.tags.join(' ')} ${x.description} ${x.category}:`; | ||
item.documentation = new vscode.MarkdownString([ | ||
`# ${x.emoji}`, | ||
`_${x.category}: ${x.tags.concat(x.description).join(', ')}_`, | ||
].join('\n')); | ||
item.insertText = x.emoji; | ||
item.range = replacementSpan; | ||
return item; | ||
|
@@ -73,9 +78,15 @@ export default class EmojiCompletionProvider implements vscode.CompletionItemPro | |
|
||
const kind = vscode.CompletionItemKind.Text; | ||
return this.emojiProvider.emojis.map((x) => { | ||
const item = new vscode.CompletionItem(`::${x.name} ${x.emoji}`, kind); | ||
item.filterText = `::${x.name}`; | ||
item.documentation = new vscode.MarkdownString(`# ${x.emoji}`); | ||
const item = new vscode.CompletionItem({ | ||
label: `::${x.name} ${x.emoji}`, | ||
description: x.tags.join(', ') | ||
}, kind); | ||
item.filterText = `::${x.name} ${x.tags.join(' ')} ${x.description} ${x.category}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think Also I don't think |
||
item.documentation = new vscode.MarkdownString([ | ||
`# ${x.emoji}`, | ||
`_${x.category}: ${x.tags.concat(x.description).join(', ')}_`, | ||
].join('\n')); | ||
item.insertText = `:${x.name}:`; | ||
item.range = replacementSpan; | ||
return item; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ import { gemoji } from 'gemoji'; | |
export interface Emoji { | ||
readonly name: string; | ||
readonly emoji: string; | ||
readonly tags: string[]; | ||
readonly description: string; | ||
readonly category: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Category is useful to search for something like animal |
||
} | ||
|
||
export class EmojiProvider { | ||
|
@@ -26,7 +29,13 @@ export class EmojiProvider { | |
for (const g of gemoji) { | ||
for (const name of g.names) { | ||
if (!this._emojiMap.has(name)) { | ||
this._emojiMap.set(name, { name, emoji: g.emoji }); | ||
this._emojiMap.set(name, { | ||
name, | ||
emoji: g.emoji, | ||
tags: g.tags, | ||
description: g.description, | ||
category: g.category | ||
}); | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change prevented duplicate suggestions, like:
It still seems to work with either
:
or::
prefixes. Is there anything else I'm missing here?