Skip to content

Repository files navigation

TOML

TOML language support for Visual Studio Code — syntax highlighting, language configuration, snippets, and an opt-in file icon. Built with vsceasy.

Features

  • Syntax highlighting for .toml files (and Cargo.lock, poetry.lock, uv.lock, Pipfile, Gopkg.lock): tables [x], array-of-tables [[x]], bare & quoted keys, basic / literal / multiline strings, integers (dec, hex, octal, binary), floats, booleans, RFC 3339 dates & times, arrays, inline tables, and # comments.
  • Language configuration# line-comment toggling, bracket matching and auto-closing for [], {}, ", ', and # region / # endregion folding.
  • Snippetstable, tablearray, kv, kvstr, array, inline, kvbool.
  • File icon (opt-in) — a TOML Icons file-icon theme.
  • Color theme (opt-in) — a TOML Dark theme that emphasizes each section.

Stronger colors

The grammar uses standard TextMate scopes, so your current theme already colors TOML. Two ways to make sections stand out more:

Option A — keep your theme, recolor only TOML. Add this to your settings.json (Preferences: Open User Settings (JSON)). It scopes to source.toml, so nothing else changes:

"editor.tokenColorCustomizations": {
  "[*]": {
    "textMateRules": [
      { "scope": "entity.name.section.table.toml, entity.name.section.table.array.toml",
        "settings": { "foreground": "#e6c07b", "fontStyle": "bold" } },
      { "scope": "punctuation.definition.table.toml, punctuation.definition.table.array.toml",
        "settings": { "foreground": "#e5945b" } },
      { "scope": "support.type.property-name.toml",
        "settings": { "foreground": "#56b6c2" } },
      { "scope": "constant.language.boolean.toml",
        "settings": { "foreground": "#c678dd" } },
      { "scope": "constant.other.datetime.offset.toml, constant.other.date.toml",
        "settings": { "foreground": "#c678dd" } }
    ]
  }
}

Option B — use the bundled theme. Preferences: Color ThemeTOML Dark. This replaces your whole editor theme (not just .toml), so prefer Option A if you only want TOML to pop.

File icon is opt-in

VS Code file icons come from an icon theme, which is global: activating one replaces all file icons in the workbench, not just .toml. This extension ships a TOML Icons theme but does not force it. To enable it, run Preferences: File Icon Theme and pick TOML Icons. Highlighting, language config and snippets work whether or not you enable the icon theme.

Install

From a packaged .vsix:

code --install-extension vscode-toml-support-*.vsix

Develop

This extension is a vsceasy project scaffolded with vsceasy create --type language.

bun install
bun run gen        # sync package.json#contributes from contributes.extra.json
bun run launch     # build + open an Extension Development Host

Open a .toml file in the dev host to see highlighting. Edit the language support directly:

File What it controls
syntaxes/toml.tmLanguage.json TextMate grammar (highlighting)
language-configuration.json comments, brackets, folding
snippets/toml.json snippets
fileicons/toml-icon-theme.json + icons/toml.svg file icon theme
contributes.extra.json wires the above into package.json#contributes

scripts/gen.ts regenerates the parts of package.json#contributes it owns and deep-merges contributes.extra.json for the language contributions — so re-run bun run gen after editing contributes.extra.json.

Packaging notes

bun run package builds a .vsix. To publish to the VS Code Marketplace you will also need a 128×128 PNG icon field in package.json and an unscoped name/publisher registered with the Marketplace (vsce rejects scoped package names).

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages