JSONL Syntax - Zed Extension
A Zed editor extension that provides syntax highlighting for JSON Lines (JSONL) and Newline Delimited JSON (NDJSON) files.
Overview
JSON Lines is a format for storing structured data with one JSON object per line. Each line is a valid JSON value, making it suitable for streaming and processing large datasets.
{"name": "John", "age": 30}
{"name": "Jane", "age": 25}
{"name": "Bob", "age": 35}Features
- Syntax highlighting for
.jsonland.ndjsonfiles - Automatic file detection
- Tree-sitter JSON parser for accurate highlighting
- 2-space indentation default
- Bundled pretty-print formatter
- Performance optimized for large files
Installation
Development Installation
Clone this repository:
git clone https://github.com/[your-username]/jsonl-syntax cd jsonl-syntaxIn Zed, open command palette (
Cmd+Shift+P/Ctrl+Shift+P)Run "zed: install dev extension" and select the
jsonl-syntaxfolder
Usage
Open any .jsonl or .ndjson file in Zed to see syntax highlighting automatically applied.
Pretty-Print JSONL
Run Zed's editor: format command from a .jsonl or .ndjson file to
pretty-print JSON Lines buffers with the bundled formatter.
The formatter parses the buffer as a stream of JSON values, so it can format
both compact JSONL and previously pretty-printed multi-line records. To format
automatically on save, enable Zed's format_on_save setting for JSON Lines.
Development
Project Structure
jsonl-syntax/
├── extension.toml # Extension configuration
├── languages/
│ └── jsonl/
│ ├── config.toml # Language settings
│ └── highlights.scm # Highlighting rules
├── server/
│ └── jsonl-lsp.js # Bundled formatter language server
├── src/
│ └── lib.rs # Zed extension entrypoint
├── sample.jsonl # Test file
└── tests/
├── jsonl_formatter.test.js
└── jsonl_lsp.test.jsMaking Changes
- Edit highlighting rules in
languages/jsonl/highlights.scm - Modify language settings in
languages/jsonl/config.toml - Reload extensions in Zed: "zed: reload extensions"
- Test changes with sample files
Contributing
Contributions are welcome.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Technical Details
This extension uses the tree-sitter-json grammar for parsing. Each JSONL line is treated as a separate JSON document for highlighting purposes.
License
MIT License - see LICENSE file for details.