Custom Emoji RenderRenders custom chat emoji references inline in the editor, so that
What it renders
Do I need an account or a token?No. The extension never authenticates, never asks for a token, and never calls any web API. It reads emoji IDs out of your text and fetches the matching image from the public emoji CDN, which serves any valid ID unauthenticated:
Names are the only thing that needs help, because a bare
To get an ID out of a chat client: type InstallFrom a
|
| Command | Does |
|---|---|
Emoji Render: Toggle Rendering |
on/off |
Emoji Render: Insert Emoji… |
pick from known emojis, inserts <:name:id> |
Emoji Render: Import Emoji Mappings… |
paste any amount of emoji text to learn many names at once |
Emoji Render: Add Emoji Mapping Manually… |
paste <:name:id> to teach it one name |
Emoji Render: Show Known Emojis |
dump the name→ID table to the output channel |
Emoji Render: Clear Image Cache |
wipe downloaded images |
Emoji Render: Diagnose Icon Rendering |
apply four icon strategies to the first four lines, to see which one paints |
Settings
| Setting | Default | Meaning |
|---|---|---|
emojiRender.enabled |
true |
master switch |
emojiRender.renderMode |
"after" |
after = image next to the text; replace = hide the text, show only the image |
emojiRender.iconSize |
0 |
size in px; 0 = auto, derived from your editor font size and line height |
emojiRender.verticalAlign |
"text-bottom" |
nudge icons up or down against the text |
emojiRender.margin |
"0 2px 0 2px" |
CSS margin around the icon |
emojiRender.animated |
"static" |
gif animates animated emojis; static shows one frame (sharper) |
emojiRender.renderShortcodes |
true |
also render bare :name: |
emojiRender.showHover |
true |
hover card with a big preview, name and ID |
emojiRender.languages |
["*"] |
restrict to specific language IDs |
emojiRender.maxFileSize |
500000 |
skip files bigger than this many chars |
emojiRender.emojis |
{} |
manual name→ID map |
How rendering works
VS Code emits decoration content icons as content: url(...). Chromium ignores
width and height on that replaced content, so the image's intrinsic size is
the rendered size — there is no way to scale it from CSS. The size therefore
has to be decided at download time, and the CDN happily serves arbitrary sizes
(?size=17 returns a real 17x17 PNG), so the icon is fetched at exactly the size
it will be drawn at. Each emoji is downloaded once and cached under the
extension's global storage directory.
Auto sizing aims for round(fontSize × 1.15), capped at lineHeight - 4. The cap
matters: an icon taller than the line box stretches the line and drags the icon
out of alignment with the text.
The one real trap, if you ever build something similar: context.globalStorageUri
uses the vscode-userdata: scheme, not file:. workspace.fs reads and writes
it happily, so the cache looks perfectly healthy — but decoration CSS only
rewrites file: URIs to the internal vscode-file: protocol the renderer can
fetch. Any other scheme is emitted verbatim, the browser never issues a request,
and the icon renders as an empty box of exactly the right size with nothing in
the logs. Anchor the cache with vscode.Uri.file(context.globalStorageUri.fsPath).
renderMode: "replace" hides the source text via display: none. It looks
cleaner but cursor movement through the hidden text feels odd, which is why
after is the default.
Troubleshooting
- Nothing renders → check the emoji ID is 15–25 digits, and open
View → Output → Emoji Renderfor fetch errors. - Deleted emojis return CDN 404 and are skipped (logged once per session).
- Behind a proxy, the CDN fetch will fail; the log shows the error.