# Settings Reference Source: https://dtexplorer.io/docs/configuration/settings Complete reference for all Design Tokens Explorer settings. All settings live under the `designTokensExplorer` namespace and can be set in workspace or user `settings.json`. Array of token source objects. See [Token Sources](/docs/configuration/sources) for the full schema and examples. Controls what happens when you click a token in the sidebar. | Value | Behavior | | ---------- | ------------------------------------------------------------ | | `"insert"` | Insert the token at the cursor position in the active editor | | `"copy"` | Copy the formatted token to the clipboard | When no editor is active or no file is open, the token is always copied to the clipboard regardless of this setting. You can also override the default action on a per-click basis by **Shift+clicking** a token to copy it even when the action is set to `insert`. Format string used when inserting a token into a CSS, SCSS, Less, or CSS-in-JS file. Use `{name}` as the placeholder for the token name. ```json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} "designTokensExplorer.cssInsertFormat": "var(--{name})" ``` **Custom format examples:** ```json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} // PostCSS custom function "designTokensExplorer.cssInsertFormat": "token(--{name})" // Tailwind arbitrary value "designTokensExplorer.cssInsertFormat": "[var(--{name})]" // Sass map access "designTokensExplorer.cssInsertFormat": "map.get($tokens, '{name}')" ``` The format must be under 200 characters. Formats that cannot be sanitized fall back to `var(--{name})`. When `true`, the raw token value is displayed below the token name in the sidebar. Set to `false` to show only token names for a more compact view. Root font size in pixels used to convert `rem` values to `px` in token previews (spacing bars, font size previews, etc.). ```json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} "designTokensExplorer.rootFontSize": 16 ``` If your project uses a non-standard root font size (e.g. `10px` with a `62.5%` base), update this value to get accurate visual previews. Restricts the hardcoded values scan to a specific path, folder, or glob pattern relative to the workspace root. `node_modules` is always excluded regardless of this setting. **Examples:** ```json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} // Default — scan all CSS files in the workspace "designTokensExplorer.usageScanPath": "**/*.css" // Scan only the src folder "designTokensExplorer.usageScanPath": "src" // Scan a specific styles folder "designTokensExplorer.usageScanPath": "app/styles" // Scan a specific file "designTokensExplorer.usageScanPath": "src/styles/main.css" // Scan CSS and SCSS files "designTokensExplorer.usageScanPath": "./**/*.{css,scss}" ``` The scan path is passed directly to `vscode.workspace.findFiles` as the include pattern. Within the matched files, only extensions supported by the scanner are processed: `.css`, `.scss`, `.less`, `.js`, `.ts`, `.jsx`, `.tsx`, `.vue`, `.astro`, `.svelte`, `.json`. Additional glob pattern(s) excluded from token usage scanning. Passed as the `exclude` argument to `vscode.workspace.findFiles`. `node_modules` is always excluded regardless of this setting. ```json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} "designTokensExplorer.scanExcludePattern": "{**/dist/**,**/build/**,**/.next/**,**/.nuxt/**,**/.git/**}" ``` Use this to exclude additional output directories, generated files, or vendor folders that are not under `node_modules`: ```json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} // Exclude Storybook static output and a legacy vendor folder "designTokensExplorer.scanExcludePattern": "{**/storybook-static/**,**/vendor/**}" ``` To exclude multiple patterns, wrap them in curly braces separated by commas — this is standard VS Code glob syntax. For example: `"{**/dist/**,**/out/**}"`. Maximum number of active hardcoded matches still considered **Good adoption** in the Adoption Audit status. ```json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} "designTokensExplorer.statusThresholdGood": 20 ``` Set this lower for stricter quality gates, or higher for gradual migration in large legacy codebases. Maximum number of active hardcoded matches considered **Discrete adoption**. Above this value, the status becomes **Poor adoption**. ```json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} "designTokensExplorer.statusThresholdDiscrete": 50 ``` If you set `statusThresholdDiscrete` lower than `statusThresholdGood`, DTE normalizes values internally to avoid invalid status ranges. When `true`, hovering over a hardcoded value entry in the audit panel scrolls the editor to that line. This lets you quickly inspect the surrounding code context without clicking. When `true`, hovering over a hardcoded value in the audit panel opens and focuses the file in the editor automatically. The **Open** button is hidden when this is enabled. This setting takes precedence over `scrollToHardcodedOnHover`. When enabled, the file opens and the editor scrolls to the relevant line. # Token Sources Source: https://dtexplorer.io/docs/configuration/sources Configure where Design Tokens Explorer loads your tokens from — local files, remote URLs, and multiple sources. ## The `sources` setting `designTokensExplorer.sources` is an array of source objects. Each source loads tokens from a local file path or remote URL and appears as a separate panel in the sidebar. ```json settings.json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} "designTokensExplorer.sources": [ { "name": "Brand Tokens", "path": "./tokens/brand.css", "groups": [ { "name": "color", "type": "color" }, { "name": "radius", "type": "radius" }, { "name": "space", "type": "size" } ] } ] ``` ## Source properties | Property | Type | Required | Description | | -------- | -------- | -------- | ---------------------------------------------------------- | | `name` | `string` | Yes | Display name shown in the sidebar panel header | | `path` | `string` | Yes | Local path (relative to workspace root) or HTTPS URL | | `groups` | `array` | No | List of token groups with optional preview type assignment | ## Groups Groups control how tokens are organized in the sidebar and which visual preview renderer is applied. Each group matches tokens by name prefix. ```json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} "groups": [ { "name": "color", "type": "color" }, { "name": "space", "type": "size" }, { "name": "radius", "type": "radius" } ] ``` A token is assigned to the group whose `name` matches the **beginning** of the token name. The `type` then controls the preview renderer shown next to the value. The group `name` must match the exact prefix used in your token names. If your tokens are named `brandColor-500`, `brandColor-400`, etc., the group name must be `brandColor` — not `color`. ```json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} // tokens: brandColor-500, brandColor-400, brandRadius-md "groups": [ { "name": "brandColor", "type": "color" }, { "name": "brandRadius", "type": "radius" } ] ``` A mismatch means those tokens won't be grouped and will fall into the **Other** category. ### Group type reference | Type | Preview rendered | Example values | | ------------- | ----------------------------------- | ---------------------------------------------------- | | `color` | Color swatch | `#7C3AED`, `rgb(124, 58, 237)`, `hsl(263, 70%, 58%)` | | `size` | Visual width bar (rem→px converted) | `1rem`, `16px`, `0.5rem` | | `radius` | Rounded corner demo | `0.5rem`, `4px`, `50%` | | `font-size` | Scaled text sample | `0.875rem`, `1.25rem` | | `font-weight` | Weight demo text | `400`, `700`, `bold` | | `line-height` | Multi-line spacing demo | `1.5`, `1.75`, `2` | | `shadow` | Shadowed element | `0 2px 4px rgba(0,0,0,0.1)` | | `easing` | SVG cubic-bezier curve | `cubic-bezier(0.4, 0, 0.2, 1)` | | `time` | Duration text | `150ms`, `0.3s` | | `filter` | No preview | `blur(4px)` | Tokens that don't match any group are placed in an **Other** group without a preview. The `type` field is optional. If omitted, DTE tries to infer the type from the group name (e.g. a group named `color` is treated as type `color`). Explicit `type` values are recommended for reliable previews. ## Supported file formats ### CSS custom properties The file must declare tokens inside a `:root {}`, `:where(html) {}`, or `@theme {}` block: ```css tokens/brand.css theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} :root { --color-primary: #7c3aed; --color-primary-light: #a78bfa; --space-1: 0.25rem; --space-2: 0.5rem; --radius-sm: 0.25rem; --radius-md: 0.5rem; } ``` Token names are extracted without the `--` prefix (`color-primary`, `space-1`, etc.). ### SCSS `.scss` files are loaded with the same parser as CSS. The file must declare tokens as CSS custom properties inside a `:root {}`, `:where(html) {}`, or `@theme {}` block. SCSS line comments (`//`) are supported inside those blocks. SCSS-specific syntax outside of custom property declarations is ignored. ```scss tokens/brand.scss theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} :root { // Colors --color-primary: #7c3aed; --color-primary-light: #a78bfa; // Spacing --space-1: 0.25rem; --space-2: 0.5rem; } ``` Use SCSS files when your token file already lives in a `.scss` context or you prefer SCSS-style (`//`) comments. The parsed output is identical to a CSS file with the same custom properties. ### JSON Flat or nested JSON objects are both supported. Nested keys are joined with `-`: ```json tokens/tokens.json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} { "color": { "primary": "#7C3AED", "neutral": { "100": "#f5f5f5", "900": "#171717" } }, "space": { "1": "0.25rem", "2": "0.5rem" } } ``` This produces tokens: `color-primary`, `color-neutral-100`, `color-neutral-900`, `space-1`, `space-2`. Nesting depth is limited to 20 levels. ### JavaScript / TypeScript (local only) String and number exports are parsed via regex — no code is executed: ```ts tokens/tokens.ts theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} export const colorPrimary = '#7C3AED'; export const spaceSm = '0.5rem'; export const fontWeightBold = 700; ``` Remote `.js` / `.ts` files are not supported for security reasons. JS/TS loading only works for local files. ## Remote sources Any `path` starting with `https://` is fetched as a remote source. The format is inferred from the file extension in the URL. ```json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} { "name": "Figma Tokens", "path": "https://tokens.example.com/tokens.json" } ``` **Remote source constraints:** * Timeout: 10 seconds * Maximum response size: 2 MB * Private IPs, localhost, and loopback addresses are blocked (SSRF protection) * `.js` / `.ts` remote sources are not supported Remote sources are fetched once on activation and re-fetched when you run **Refresh Sources**. They are not watched for changes automatically. ## File watching Local sources are watched for changes. When the file is saved, tokens are automatically reloaded after a 400 ms debounce and the sidebar refreshes. The usage audit also re-runs in the background. ## Multiple sources You can configure any number of sources. Each appears as a separate, switchable panel in the sidebar. See [Multiple Sources](/docs/guides/multiple-sources) for practical examples. # Adoption Audit Source: https://dtexplorer.io/docs/features/adoption-audit Find hardcoded values in your codebase that should be replaced with design tokens — and fix them in one click. ## Overview The **DTE Hardcoded Values** panel scans your workspace for literal values that match any loaded token value. It helps you migrate an existing codebase toward full design token adoption by surfacing every place a hardcoded value is used when a token already exists. Open the panel from the bottom panel bar or via the Command Palette: ``` Design Tokens: Open Hardcoded Values Audit ``` ## Usage status The top of the panel shows a status badge based on the total number of active (non-ignored) hardcoded matches found: | Status | Threshold | Meaning | | ------------ | --------- | ------------------------------------------ | | **Optimal** | 0 | No hardcoded values — full token adoption | | **Good** | 1–20 | A few remaining occurrences | | **Discrete** | 21–50 | Moderate usage — worth addressing | | **Bad** | 51+ | High hardcoded value count — action needed | The default thresholds are configurable via [`statusThresholdGood`](/docs/configuration/settings#designtokensexplorer-statusthresholdgood) and [`statusThresholdDiscrete`](/docs/configuration/settings#designtokensexplorer-statusthresholddiscrete). The status badge also appears as a notification icon in the sidebar activity bar and updates automatically after each scan. ## How scanning works When a scan runs, DTE: 1. Uses the glob pattern in [`usageScanPath`](/docs/configuration/settings#designtokensexplorer-usagescanpath) to find files (default: `**/*.css`) 2. Applies the exclusion pattern in [`scanExcludePattern`](/docs/configuration/settings#designtokensexplorer-scanexcludepattern) (default: `{**/dist/**,**/build/**,**/.next/**,**/.nuxt/**,**/.git/**}`). `node_modules` is always excluded. 3. Filters the matched files to supported extensions: `.css`, `.scss`, `.less`, `.js`, `.ts`, `.jsx`, `.tsx`, `.vue`, `.astro`, `.svelte`, `.json` 4. Reads up to 6 files in parallel 5. For each file, searches for every token value as a literal substring (case-insensitive) 6. Records: file path, line number, column, surrounding line text, matched tokens Scans run automatically on activation, on token source changes, and when configuration changes. You can also trigger a manual scan: ``` Design Tokens: Re-scan Token Usage ``` ## Hardcoded value entries Each entry in the list shows: * **File path** and **line number** * **The hardcoded value** that was found * **Matching tokens** — the token(s) whose value matches the hardcoded literal * **Line preview** — the surrounding code for context * **Actions**: Replace, Open, Ignore ### Replace Clicking **Replace** substitutes the hardcoded value with the formatted token at that location. The replacement uses the same language-aware formatting as [Token Insertion](/docs/features/token-insertion) — so in a CSS file it inserts `var(--token-name)`, in a JS file it inserts `'token-name'`, etc. The file is saved automatically after replacement. ### Open Clicking **Open** (or hovering when [`openFileOnHover`](/docs/configuration/settings#designtokensexplorer-openfileonhover) is enabled) opens the file in the editor and scrolls to the relevant line. ### Ignore Clicking **Ignore** marks that specific occurrence as intentionally hardcoded. It is removed from the list and will not reappear in future scans. Ignored entries are persisted in `.vscode/dte-ignored.json` in your workspace. To un-ignore an entry, click **Unignore** — the entry reappears in subsequent scans. When all entries in a file are ignored, that file section auto-collapses in the panel. If you use **Unignore all**, the section auto-expands again. The `.vscode/dte-ignored.json` file is workspace-local. You can commit it to share ignore decisions across your team, or add it to `.gitignore` to keep it local. ## Semantic suggestions In addition to exact value matches, DTE also shows **semantic suggestions** — cases where a hardcoded value is likely a token based on the CSS property name, even if the exact value isn't in your token set. For example, if you have a token `--color-primary: #7c3aed` and a line: ```css theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} color: #7c3aed; ``` This is an exact match. But semantic matching also helps when a property name like `background-color` is paired with any value resembling a color, prompting a suggestion to check if a token applies. Semantic suggestions appear with a different visual indicator and are scored by relevance — only the most likely candidates are shown (up to 5 per occurrence). ## Restricting the scan scope By default, the audit scans `**/*.css` (all CSS files in the workspace). Use [`usageScanPath`](/docs/configuration/settings#designtokensexplorer-usagescanpath) to broaden or narrow the scope: ```json settings.json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} // Scan CSS and SCSS files "designTokensExplorer.usageScanPath": "./**/*.{css,scss}" // Scan only the src directory (all supported file types within it) "designTokensExplorer.usageScanPath": "src" // Scan a specific styles folder "designTokensExplorer.usageScanPath": "app/styles" ``` To exclude additional directories (e.g. generated files, storybook output), use [`scanExcludePattern`](/docs/configuration/settings#designtokensexplorer-scanexcludepattern): ```json settings.json theme={"theme":{"light":"material-theme-ocean","dark":"material-theme-ocean"}} "designTokensExplorer.scanExcludePattern": "{**/storybook-static/**,**/vendor/**}" ``` ## Hover behaviors Two settings control what happens when you hover over an entry in the audit list: * [`scrollToHardcodedOnHover`](/docs/configuration/settings#designtokensexplorer-scrolltohardcodedonhover) (default `true`) — scrolls the editor to the line in the background * [`openFileOnHover`](/docs/configuration/settings#designtokensexplorer-openfileonhover) (default `false`) — opens and focuses the file when hovering # Autocomplete Source: https://dtexplorer.io/docs/features/autocomplete Get design token autocomplete suggestions as you type in CSS, SCSS, Less, and CSS-in-JS files. ## Overview Design Tokens Explorer provides IntelliSense autocomplete for all loaded tokens in CSS-family files. As you type a `var(--` expression, a list of matching tokens appears with their values shown inline — no need to switch to the sidebar. ## Supported languages Autocomplete is active in the following languages: * CSS * SCSS * Less * JavaScript / TypeScript with CSS-in-JS patterns * JSX / TSX * Vue (inside `