Unicode Typst
Unicode Typst is a VS Code extension that completes Typst math symbol names into their Unicode characters. Type a symbol name such as alpha or arrow.r and accept the completion to insert α or →.
The extension follows the naming convention of Unicode Latex: the package name is unicode-typst and the display name is Unicode Typst.
Features
- Completes Typst-style symbol names from Typst's open-source
typst/codex symbol definitions.
- Supports dotted symbol variants such as
arrow.r.double, lt.eq.slant, and plus.minus.
- Supports implicit completion inside inline math, such as
$ al| $, without requiring a trigger character.
- Supports explicit completion outside math with a configurable trigger character, such as
#alpha.
- Re-registers the completion provider when the trigger character or target language configuration changes.
- Handles escaped dollar signs when detecting math mode, so
\$ does not start or end math.
- Provides commands for quick-pick insertion and replacing symbol names in the current selection or document.
Commands
Unicode: Insert Typst Math Symbol
Opens a searchable quick pick. Select a symbol to insert it at the current selection.
Unicode: Replace Typst Symbols
Replaces symbol names in the selected text. If no text is selected, it acts on the whole document.
Explicit forms such as #alpha are replaced everywhere. When typstUnicode.implicitMathMode is enabled, bare names inside inline math are also replaced, such as $ alpha + beta $.
Configuration
The extension contributes these settings:
typstUnicode.targetLanguages
Default:
["typst", "markdown", "plaintext"]
Language IDs where completions should be registered. Add another language ID if you want completions in that language. Use "*" to register completions globally.
typstUnicode.implicitMathMode
Default:
true
When enabled, completions are available without the trigger character while the cursor is inside inline math delimited by unescaped $ characters.
typstUnicode.triggerCharacter
Default:
"#"
The single character required to request completions outside math mode. For example, with the default setting, typing #arrow.r can complete to →.
Usage
Inside math mode:
$ alpha + beta $
Start typing al or alpha, then accept the completion for alpha to insert α.
Outside math mode:
#alpha
Accept the completion for alpha and the full text #alpha is replaced with α.
Build From Source
Install dependencies and compile the extension:
npm install
npm run compile
Run Extension Host tests:
npm test
Create a VSIX package:
npm run package
Install the generated package:
code --install-extension unicode-typst-0.1.0.vsix
Updating Symbols
The symbol table in src/symbols.ts is generated from Typst's typst/codex src/modules/sym.txt file. The committed table was generated from the codex revision pinned by Typst's Cargo.toml.
Refresh from the latest upstream file:
npm run update-symbols
Refresh from a local checkout or a pinned file:
node ./scripts/update-symbols.mjs /path/to/codex/src/modules/sym.txt
Development
Run the TypeScript compiler in watch mode:
npm run watch
Open the project in VS Code and press F5 to launch an Extension Development Host. The extension activates for Typst, Markdown, and plaintext files by default. It also activates after startup so custom target language settings can be honored.
Third-Party Data
The generated symbol data is derived from Typst codex, which is licensed under the Apache License 2.0. See THIRD_PARTY_NOTICES.md.