This guide explains how to add NATS server configuration file support to Zed.
Zed has first-class tree-sitter support. You can add NATS server configuration support by creating a Zed extension.
- Zed 0.131+ (with extension support)
- Rust toolchain (for building the extension)
mkdir -p ~/.local/share/zed/extensions/nats-server-conf
cd ~/.local/share/zed/extensions/nats-server-confOn macOS, use ~/Library/Application Support/Zed/extensions/nats-server-conf instead.
id = "nats-server-conf"
name = "NATS Server Configuration"
description = "Tree-sitter grammar and syntax highlighting for NATS server configuration files."
version = "0.1.2"
schema_version = 1
authors = ["Your Name <your@email.com>"]
repository = "https://github.com/synadia-labs/treesitter-nats-server"
[grammars.nats_server_conf]
repository = "https://github.com/synadia-labs/treesitter-nats-server"
rev = "main"Create languages/nats-server-conf/config.toml:
mkdir -p languages/nats-server-confname = "NATS Server Config"
grammar = "nats_server_conf"
path_suffixes = ["conf"]
line_comments = ["# ", "// "]
block_comment = []
brackets = [
{ start = "{", end = "}", close = true, newline = true },
{ start = "[", end = "]", close = true, newline = false },
{ start = "\"", end = "\"", close = true, newline = false, not_in = ["string"] },
]Copy the query files from this repository into the extension:
QUERIES_DIR="languages/nats-server-conf"
cp /path/to/treesitter-nats-server/queries/highlights.scm "$QUERIES_DIR/"
cp /path/to/treesitter-nats-server/queries/folds.scm "$QUERIES_DIR/"
cp /path/to/treesitter-nats-server/queries/indents.scm "$QUERIES_DIR/"Create languages/nats-server-conf/file_types.toml:
path_suffixes = ["conf"]
file_stems = ["nats-server", "nats"]
[[path_glob]]
glob = "*nats*.conf"Restart Zed or use the command palette:
zed: reload extensions
Open a NATS configuration file. You should see syntax highlighting and the language indicator showing "NATS Server Config" in the status bar.
If you want to iterate on the extension during development:
- Clone this repository
- In Zed, open the command palette and run
zed: install dev extension - Select the cloned repository directory
- Zed will build and load the extension automatically
This approach auto-reloads the extension when you make changes.
- No highlighting: Check that the query files are present in
languages/nats-server-conf/and that the grammar name matchesnats_server_conf - Extension not loading: Open
zed: open logfrom the command palette and look for extension-related errors - Wrong language detected:
.confis a generic extension. Zed matches by file path glob, so ensure your file name containsnats