Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.mjs"
],
"preLaunchTask": "npm: build"
}
]
}
8 changes: 6 additions & 2 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ src/
.gitignore
eslint.config.mjs
pnpm-lock.yaml
pnpm-workspace.yaml
tsconfig.json
*.md
!README.md
tsdown.config.ts
CONTRIBUTING.md
**/*.map
**/*.ts
!dist/**
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

## 0.1.0

Initial release.

### Features

- Bidirectional JSON/JSONC to TOON conversion
- Selection-aware conversion in any file type
- Explorer context menu for file-to-file conversion with save dialog
- Editor context menu when text is selected
- Keyboard shortcuts: `Cmd+Alt+T` / `Ctrl+Alt+T` (to TOON), `Cmd+Alt+J` / `Ctrl+Alt+J` (to JSON)
- TextMate grammar for `.toon` syntax highlighting
- Real-time TOON validation with diagnostics in the Problems panel
- Configurable encoding options (indent, delimiter, key folding)
- Configurable decoding options (path expansion)
111 changes: 61 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,88 @@
# TOON Format for Visual Studio Code
# TOON — JSON ↔ TOON Converter for VS Code

> **⚠️ Development Status:** This extension is in early development. Bare minimum setup for team collaboration.
Bidirectional conversion between JSON and [TOON](https://toonformat.dev) (Token-Oriented Object Notation), with syntax highlighting and real-time validation.

Visual Studio Code extension for TOON format support. TOON is a compact, human-readable serialization format for LLM contexts with 30-60% token reduction vs JSON.
TOON is a compact, human-readable format that achieves ~40% fewer tokens than JSON while maintaining lossless, deterministic round-trips. Designed for LLM contexts where every token has a cost.

## Features

Currently in development. Planned features:
- **Bidirectional conversion** — Convert JSON/JSONC to TOON and back
- **Selection-aware** — Select text in any file to convert just that fragment
- **Context menu** — Right-click `.json` or `.toon` files in the explorer
- **Keyboard shortcuts** — `Cmd+Alt+T` (to TOON), `Cmd+Alt+J` (to JSON)
- **Syntax highlighting** — Full TextMate grammar for `.toon` files
- **Real-time validation** — Errors appear in the Problems panel as you type
- **Configurable** — Indent size, delimiter style, key folding, path expansion

- Syntax highlighting for `.toon` files
- Format validation and error detection
- Code formatting and auto-completion
- Integration with TOON specification
## Usage

## Installation
### Convert in the editor

This extension is not yet published to the Visual Studio Marketplace. To install locally:
1. Open a `.json` file
2. Press `Cmd+Alt+T` (Mac) or `Ctrl+Alt+T` (Windows/Linux)
3. The file content is replaced with TOON and the language mode switches

```bash
git clone https://github.com/toon-format/vscode.git
cd toon-vscode
pnpm install
pnpm build
```
To convert back: open the `.toon` file and press `Cmd+Alt+J` / `Ctrl+Alt+J`.

## Development
### Convert a selection

```bash
# Setup
git clone https://github.com/toon-format/vscode.git
cd toon-vscode
pnpm install
Select any JSON or TOON text in any file (`.md`, `.txt`, etc.) and:
- Right-click → "Convert JSON to TOON" or "Convert TOON to JSON"
- Or use the keyboard shortcuts

# Build
pnpm build
### Save as a new file

# Development mode (watch)
pnpm dev
Right-click a `.json` file in the Explorer → "Convert to TOON (Save As...)"
Right-click a `.toon` file in the Explorer → "Convert to JSON (Save As...)"

# Run linting
pnpm lint
A save dialog appears so you choose the output location.

# Type check
pnpm test:types
### Command Palette

# Package extension
pnpm package
```
All commands are available via `Cmd+Shift+P`:
- `Convert JSON to TOON`
- `Convert TOON to JSON`
- `Convert to TOON (Save As...)`
- `Convert to JSON (Save As...)`

## Project Status & Roadmap
## Settings

Following semantic versioning towards 1.0.0:
| Setting | Default | Description |
|---------|---------|-------------|
| `toon.encode.indent` | `2` | Indentation size for TOON output |
| `toon.encode.delimiter` | `,` | Delimiter for tabular arrays (`,`, `\|`, `\t`) |
| `toon.encode.keyFolding` | `off` | Dotted key folding (`off` or `safe`) |
| `toon.decode.expandPaths` | `off` | Expand dotted keys on decode (`off` or `safe`) |
| `toon.json.indent` | `2` | Indentation size for JSON output |
| `toon.openAfterConvert` | `true` | Open converted file after saving |
| `toon.validation.enable` | `true` | Enable real-time validation in Problems panel |

- **v0.0.x** - Initial project setup, bare minimum structure (current)
- **v0.1.x** - Basic syntax highlighting and file recognition
- **v0.2.x** - Format validation and error detection
- **v0.3.x** - Code formatting and auto-completion
- **v1.0.0** - First stable release with full TOON format support
## Development

Requires Node.js 22+ for build tooling.

See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
```bash
git clone https://github.com/akumarpalo/vscode.git
cd vscode
pnpm install
pnpm build
```

## Documentation
Press F5 in VS Code to launch the Extension Development Host.

- [📜 TOON Specification](https://github.com/toon-format/spec) - Official specification
- [🐛 Issues](https://github.com/toon-format/vscode/issues) - Bug reports and features
- [🤝 Contributing](CONTRIBUTING.md) - Contribution guidelines
```bash
pnpm dev # Watch mode
pnpm lint # Lint
pnpm test:types # Type check
pnpm package # Build .vsix
```

## Related Projects
## Links

- [toon](https://github.com/toon-format/toon) - TypeScript implementation
- [toon-python](https://github.com/toon-format/toon-python) - Python implementation
- [toon-rust](https://github.com/toon-format/toon-rust) - Rust implementation
- [TOON Specification](https://github.com/toon-format/spec)
- [TOON TypeScript Library](https://github.com/toon-format/toon)
- [Issues](https://github.com/akumarpalo/vscode/issues)

## License

MIT License – see [LICENSE](LICENSE) for details
MIT
1 change: 1 addition & 0 deletions images/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"brackets": [
["[", "]"],
["{", "}"]
],
"autoClosingPairs": [
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "\"", "close": "\"", "notIn": ["string"] }
],
"surroundingPairs": [
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "\"", "close": "\"" }
],
"folding": {
"offSide": true
},
"indentationRules": {
"increaseIndentPattern": "^.+:\\s*$",
"decreaseIndentPattern": "^\\s*$"
},
"wordPattern": "[^\\s,:\\[\\]{}\"']+"
}
Loading