Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Changelog

## [0.1.0] - 2025-12-24

### Added
- Syntax highlighting for `.toon` files
- File recognition with `.toon` extension
- Language configuration with proper indentation and brackets
- TextMate grammar for TOON syntax
- Basic example file

### Grammar (spec-compliant)
- Array header syntax: `key[N]: v1,v2` and `key[N]{f1,f2}:` tabular headers
- Dotted key support: `user.name: value`
- List item markers: `- value`
- Strings (quoted), numbers, booleans, null values
- No comment syntax (TOON has none per spec)

## [0.0.1] - 2025-12-24

### Added
- Initial project setup with TypeScript and build pipeline
- Basic extension scaffolding
- Development tooling (ESLint, tsdown, pnpm)
66 changes: 34 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,54 @@
# TOON Format for Visual Studio Code
# TOON for VS Code

> **⚠️ Development Status:** This extension is in early development. Bare minimum setup for team collaboration.

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.
VS Code extension for TOON (Token-Oriented Object Notation) format.

## Features

Currently in development. Planned features:
- **Syntax highlighting** for `.toon` files
- **File recognition** with `.toon` extension
- **Language support** with proper indentation and brackets

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

## Installation
```toon
name: John Doe
age: 30
active: true

This extension is not yet published to the Visual Studio Marketplace. To install locally:
address:
street: 123 Main St
city: New York

```bash
git clone https://github.com/toon-format/vscode.git
cd toon-vscode
pnpm install
pnpm build
hobbies[3]: reading,coding,hiking

projects[2]{id,name,status}:
1,Alpha,active
2,Beta,completed
```

## Status

**v0.1.0** - Basic syntax highlighting and file recognition βœ…

## Roadmap

- **v0.0.x** - Initial project setup βœ…
- **v0.1.x** - Basic syntax highlighting βœ…
- **v0.2.x** - Format validation (next)
- **v0.3.x** - Code formatting and auto-completion (planned)
- **v1.0.0** - First stable release (planned)

## Development

```bash
# Setup
git clone https://github.com/toon-format/vscode.git
cd toon-vscode
pnpm install

# Build
pnpm build
```

# Development mode (watch)
pnpm dev

# Run linting
pnpm lint

# Type check
pnpm test:types
## Links

# Package extension
pnpm package
```
- [TOON Specification](https://github.com/toon-format/spec)
- [Report Issues](https://github.com/toon-format/vscode/issues)

## Project Status & Roadmap

Expand Down
26 changes: 18 additions & 8 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# TOON VSCode Extension Documentation
# TOON Extension Docs

This directory will contain comprehensive documentation for the TOON VSCode extension.
Basic documentation for the TOON VS Code extension.

## Coming Soon
## Quick Reference

- Installation guide
- Feature documentation
- Configuration options
- Development guide
- API reference
- **File extension**: `.toon`
- **Format**: Indentation-based like YAML, tabular arrays like CSV
- **Arrays**: `key[N]: v1,v2,v3` or tabular `key[N]{f1,f2}:`
- **Dotted keys**: `user.name: value`

## Example

```toon
name: Example
user.role: admin
items[3]: a,b,c
rows[2]{id,name}:
1,Alice
2,Bob
```
15 changes: 15 additions & 0 deletions examples/basic.toon
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: John Doe
age: 30
active: true

address:
street: 123 Main St
city: New York

hobbies[3]: reading,coding,hiking

projects[2]{id,name,status}:
1,Alpha,active
2,Beta,completed

user.role: admin
20 changes: 20 additions & 0 deletions language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"brackets": [
["[", "]"],
["{", "}"]
],
"autoClosingPairs": [
{ "open": "[", "close": "]" },
{ "open": "{", "close": "}" },
{ "open": "\"", "close": "\"" }
],
"surroundingPairs": [
["[", "]"],
["{", "}"],
["\"", "\""]
],
"indentationRules": {
"increaseIndentPattern": "^\\s*(?:[A-Za-z_][A-Za-z0-9_.]*|\"[^\"]*\")(?:\\[\\d+[|\\t]?\\](?:\\{[^}]*\\})?)?:\\s*$",
"decreaseIndentPattern": "^\\s*$"
}
}
26 changes: 22 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "toon",
"displayName": "Token-Oriented Object Notation (TOON) Support",
"type": "module",
"version": "0.0.1",
"version": "0.1.0",
"packageManager": "pnpm@10.23.0",
"description": "Visual Studio Code extension for TOON format support",
"license": "MIT",
Expand All @@ -18,7 +18,10 @@
"keywords": [
"toon",
"format",
"serialization"
"serialization",
"llm",
"token-efficient",
"json-alternative"
],
"categories": [
"Programming Languages",
Expand All @@ -30,10 +33,25 @@
"node": ">=24.0.0"
},
"contributes": {
"languages": [
{
"id": "toon",
"aliases": ["TOON", "toon"],
"extensions": [".toon"],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "toon",
"scopeName": "source.toon",
"path": "./syntaxes/toon.tmLanguage.json"
}
],
"commands": [
{
"command": "toon.helloWorld",
"title": "TOON: Hello World"
"command": "toon.hello",
"title": "TOON: Hello"
}
]
},
Expand Down
8 changes: 4 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as vscode from 'vscode'

export function activate(context: vscode.ExtensionContext): void {
// Register the hello world command
const disposable = vscode.commands.registerCommand('toon.helloWorld', () => {
vscode.window.showInformationMessage('Hello World from TOON!')
// Basic hello command for initial setup
const helloCommand = vscode.commands.registerCommand('toon.hello', () => {
vscode.window.showInformationMessage('TOON extension activated! Ready for development.')
})

context.subscriptions.push(disposable)
context.subscriptions.push(helloCommand)
}

export function deactivate(): void {
Expand Down
82 changes: 82 additions & 0 deletions syntaxes/toon.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "TOON",
"scopeName": "source.toon",
"patterns": [
{ "include": "#tabular-header" },
{ "include": "#array-header" },
{ "include": "#list-item" },
{ "include": "#key-value" }
],
"repository": {
"tabular-header": {
"comment": "Β§6: key[N]{f1,f2}: or key[N|]{f1|f2}: or key[N\t]{f1\tf2}:",
"match": "^(\\s*)([A-Za-z_][A-Za-z0-9_.]*|\"[^\"]*\")(\\[\\d+[|\\t]?\\])(\\{[^}]*\\})(:)(.*)",
"captures": {
"2": { "name": "entity.name.tag.toon" },
"3": { "name": "constant.numeric.toon" },
"4": { "name": "entity.other.attribute-name.toon" },
"5": { "name": "punctuation.separator.key-value.toon" },
"6": { "patterns": [{ "include": "#values" }] }
}
},
"array-header": {
"comment": "Β§6: key[N]: or key[N|]: or key[N\t]: β€” also root [N]:",
"match": "^(\\s*)([A-Za-z_][A-Za-z0-9_.]*|\"[^\"]*\")?(\\[\\d+[|\\t]?\\])(:)(.*)",
"captures": {
"2": { "name": "entity.name.tag.toon" },
"3": { "name": "constant.numeric.toon" },
"4": { "name": "punctuation.separator.key-value.toon" },
"5": { "patterns": [{ "include": "#values" }] }
}
},
"list-item": {
"comment": "Β§9.4, Β§10: list item starting with '- '",
"match": "^(\\s*)(-)( )(.*)",
"captures": {
"2": { "name": "punctuation.definition.list.begin.toon" },
"4": { "patterns": [{ "include": "#tabular-header" }, { "include": "#array-header" }, { "include": "#key-value" }, { "include": "#values" }] }
}
},
"key-value": {
"comment": "Β§7.3, Β§8: simple or dotted key followed by colon",
"match": "^(\\s*)([A-Za-z_][A-Za-z0-9_.]*|\"[^\"]*\")(:)(.*)",
"captures": {
"2": { "name": "entity.name.tag.toon" },
"3": { "name": "punctuation.separator.key-value.toon" },
"4": { "patterns": [{ "include": "#values" }] }
}
},
"values": {
"patterns": [
{ "include": "#string-quoted" },
{ "include": "#number" },
{ "include": "#boolean" },
{ "include": "#null" }
]
},
"string-quoted": {
"name": "string.quoted.double.toon",
"begin": "\"",
"end": "\"",
"patterns": [
{ "name": "constant.character.escape.toon", "match": "\\\\[\\\\\"nrt]" },
{ "name": "invalid.illegal.escape.toon", "match": "\\\\." }
]
},
"number": {
"name": "constant.numeric.toon",
"match": "(?<![A-Za-z0-9_.])-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?(?![A-Za-z0-9_.])"
},
"boolean": {
"patterns": [
{ "name": "constant.language.boolean.true.toon", "match": "\\btrue\\b" },
{ "name": "constant.language.boolean.false.toon", "match": "\\bfalse\\b" }
]
},
"null": {
"name": "constant.language.null.toon",
"match": "\\bnull\\b"
}
}
}
Loading