Skip to content

Complete with actual emoji - #8

Open
math2001 wants to merge 12 commits into
akatopo:masterfrom
math2001:master
Open

math2001 wants to merge 12 commits into
akatopo:masterfrom
math2001:master

Conversation

@math2001

Copy link
Copy Markdown

Hi!

If you enabled the setting github_emoji_complete_with_emoji, then it'll complete with the actual emoji instead of the alias.

I updated how the plugin worked too:

The emojis are stored in two JSON files:

  • emoji.json
  • commit-emoji.json

Note: A little python program allows you to automatically update the first one (you obviously need an internet connection)

They have the same structure:

[
    [alias, symbol, description],
    [alias, symbol, description],
    [alias, symbol, description],
    ...
]

The only difference is the meaning: in the commit-emoji.json file, the description is the meaning of the emoji, that's all.

The format of the list that you had in the settings is created when the plugin is loaded. There are 4 lists:

  1. For regular emojis → alias
  2. For regular emojis → symbol
  3. For commit emojis → alias
  4. For commit emojis → symbol

I also updated the readme to let people know about this feature.

Let me know what you think!

@akatopo

akatopo commented Apr 1, 2017

Copy link
Copy Markdown
Owner

Hello

Sorry for the late reply. First of all thanks for your contribution! 😃

I took your version for a spin and I've got a few issues / questions before I can merge it.

commitEmojis options is actually useful, I'm using it myself for custom commit emoji 😛. Same with emojiCompletions in case the user wants to override the default emoji set. Could you make it so that if the user defines a commitEmojis or emojiCompletions in the user settings it overrides the creation of emojis_alias and commit_emojis_alias? For example this would limit the available emoji to whatever is defined in emojiCompletions and the commit emoji to commitEmojiCompletions

{
  "emojiCompletions": [
    [":smile: 😄\tsmiling face with open mouth and smiling eyes", "smile:"],
    [":smiley: 😃\tsmiling face with open mouth", "smiley:"],
    //...
  ],
  "commitEmojiCompletions": [
    [":bookmark: 🔖\tversion tag", ":bookmark:"],
    [":books: 📚\tdocumentation", ":books:"],
    ["version tag 🔖\t:bookmark:", ":bookmark:"],
    ["documentation 📚\t:books:", ":books:"],
  ]
}

Generally I think that you could use a map of aliases to emoji symbols if github_emoji_complete_with_emoji is enabled in syntax-specific settings, but that's up to you.

Ex.

{
  "pout:": "😡",
  // ...
}

I'll put a few more comments inline :-D

Comment thread GithubEmojiCompletions.py
commit_emojis_emoji = []
for emo in commit_emojis:
commit_emojis_alias.append([":{}: {}\t{}".format(*emo), ":{}:".format(emo[0])])
commit_emojis_alias.append([":{}: {}\t{}".format(*reversed(emo)), ":{}:".format(emo[0])])

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can omit the colon here: commit_emojis_alias.append(["{} {}\t{}".format(*reversed(emo)), ":{}:".format(emo[0])])

Comment thread GithubEmojiCompletions.py
# is printed as more than one character

actual_emojis = list(map(lambda emo: emo[1], emojis))
for region in view.sel():

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for emojis like this one [":arrow_backward: ◀️\tblack left-pointing triangle", "arrow_backward:"]?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants