🎨 Design Tokens Language Server 🪙Editor tools for working with DTCG formatted design tokens in CSS, and for token definitions in JSON or YAML files.
✨ Features⛸️ Hover DocsDisplay markdown-formatted token descriptions and value when hovering over token names. ✂️ SnippetsAuto complete for design tokens - get code snippets for token values with optional fallbacks. 🥼 DiagnosticsDTLS complains when your stylesheet contains a 🦸 Code actionsToggle the presence of a token
🎨 Document ColorDisplay token color values in your source, e.g. as swatches. 👂 Semantic TokensHighlight token references inside token definition files. 🪪 Go to DefinitionJump to the position in the tokens file where the token is defined. Can also jump from a token reference in a JSON file to the token's definition. Go to definition in a split window using Neovim's
🗺️ ReferencesLocate all references to a token in open files, whether in CSS or in the token definition JSON or YAML files 🧰 UsageDownload the latest release for your platform and place the binary in your
🛻 InstallationNeovim
VSCodeInstall from the vscode marketplace. Other editorsYou can also build development extension for Zed. See
⚙️ ConfigurationIn order to use DTLS, you need to first configure it to know where to find your design tokens, and you can also provide it with options for how to deal with them. 🪙 Token filesDesign Tokens Language Server uses the DTCG format for design tokens. If you have a design token file in a different format, you can use style-dictionary to convert it to DTCG. You can configure the language server globally on on a per-project basis.
Per-project configuration is done via a
Add a
Global configurationYou can set up global configuration in your editor's LSP settings for DTLS. This
configuration will be used as fallbacks for all projects. There's no need to set
them if your project already has a For example, in your lsp config for neovim:
Token PrefixesThe DTCG format does not require a prefix for tokens, but it is recommended to
use a prefix to avoid conflicts with other design systems. if your token files
do not nest all of their tokens under a common prefix, you can pass one yourself
in the Group MarkersBecause the DTCG format is nested, a conflict can emerge when the token file
author wants to define a group of tokens, but have the group name also be a
token. For example, Design Tokens Language Server therefore has a concept of "group markers" to contain the token data for a group. The group marker is a well-known token name that is used to represent the group's top-most token. The default group markers are If you include the For example, if you have a token file with the following tokens:
Then, set the
🤝 Contributing🏗️ Building
Install Deno and clone this repo. Run this task to build
and install the binary to
🧪 TestingRun tests with:
Watch tests with:
Generate coverage reports with:
🪲 DebuggingThe server logs to
If you'd like to trace lsp messages in real time, try lsp-devtools |