diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..3642d18 --- /dev/null +++ b/CHANGELOG.md @@ -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 + +### Features +- Comments with `#` +- Strings (quoted and unquoted) +- Numbers, booleans, null values +- Object keys and nested structures +- Array syntax with brackets + +## [0.0.1] - 2025-12-24 + +### Added +- Initial project setup with TypeScript and build pipeline +- Basic extension scaffolding +- Development tooling (ESLint, tsdown, pnpm) \ No newline at end of file diff --git a/README.md b/README.md index 1a3c884..23f6286 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,51 @@ -# 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 +# TOON syntax +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: [reading, coding, hiking] ``` +## 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 diff --git a/docs/README.md b/docs/README.md index d3f93ab..3ffc5fa 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,11 +1,19 @@ -# 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 +- **Comments**: Start with `#` +- **Arrays**: Use `[item1, item2]` or multi-line format + +## Example + +```toon +name: Example +items: [a, b, c] +nested: + key: value +``` diff --git a/examples/basic.toon b/examples/basic.toon new file mode 100644 index 0000000..9b17d86 --- /dev/null +++ b/examples/basic.toon @@ -0,0 +1,12 @@ +# Basic TOON example +name: John Doe +age: 30 +active: true + +# Nested object +address: + street: 123 Main St + city: New York + +# Array +hobbies: [reading, coding, hiking] \ No newline at end of file diff --git a/language-configuration.json b/language-configuration.json new file mode 100644 index 0000000..c776644 --- /dev/null +++ b/language-configuration.json @@ -0,0 +1,25 @@ +{ + "comments": { + "lineComment": "#" + }, + "brackets": [ + ["[", "]"], + ["(", ")"] + ], + "autoClosingPairs": [ + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ], + "surroundingPairs": [ + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ], + "indentationRules": { + "increaseIndentPattern": "^\\s*.*:\\s*$", + "decreaseIndentPattern": "^\\s*$" + } +} diff --git a/package.json b/package.json index 1fc2c75..2cc5e6f 100644 --- a/package.json +++ b/package.json @@ -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", @@ -18,7 +18,10 @@ "keywords": [ "toon", "format", - "serialization" + "serialization", + "llm", + "token-efficient", + "json-alternative" ], "categories": [ "Programming Languages", @@ -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" } ] }, diff --git a/src/extension.ts b/src/extension.ts index 7c976c7..b85e05c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -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 { diff --git a/syntaxes/toon.tmLanguage.json b/syntaxes/toon.tmLanguage.json new file mode 100644 index 0000000..7916629 --- /dev/null +++ b/syntaxes/toon.tmLanguage.json @@ -0,0 +1,144 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "TOON", + "scopeName": "source.toon", + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#strings" + }, + { + "include": "#numbers" + }, + { + "include": "#booleans" + }, + { + "include": "#null" + }, + { + "include": "#keys" + }, + { + "include": "#arrays" + } + ], + "repository": { + "comments": { + "patterns": [ + { + "name": "comment.line.number-sign.toon", + "match": "#.*$" + } + ] + }, + "strings": { + "patterns": [ + { + "name": "string.quoted.double.toon", + "begin": "\"", + "end": "\"", + "patterns": [ + { + "name": "constant.character.escape.toon", + "match": "\\\\." + } + ] + }, + { + "name": "string.quoted.single.toon", + "begin": "'", + "end": "'", + "patterns": [ + { + "name": "constant.character.escape.toon", + "match": "\\\\." + } + ] + }, + { + "name": "string.unquoted.toon", + "match": "(?<=:\\s)[^\\s#\\[\\]()][^#\\n]*" + } + ] + }, + "numbers": { + "patterns": [ + { + "name": "constant.numeric.toon", + "match": "\\b-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b" + } + ] + }, + "booleans": { + "patterns": [ + { + "name": "constant.language.boolean.true.toon", + "match": "\\btrue\\b" + }, + { + "name": "constant.language.boolean.false.toon", + "match": "\\bfalse\\b" + } + ] + }, + "null": { + "patterns": [ + { + "name": "constant.language.null.toon", + "match": "\\bnull\\b" + } + ] + }, + "keys": { + "patterns": [ + { + "name": "entity.name.tag.toon", + "match": "^\\s*([a-zA-Z_][a-zA-Z0-9_]*)\\s*:", + "captures": { + "1": { + "name": "entity.name.tag.toon" + } + } + }, + { + "name": "entity.name.tag.quoted.toon", + "match": "^\\s*(\"[^\"]*\"|'[^']*')\\s*:", + "captures": { + "1": { + "name": "string.quoted.toon" + } + } + } + ] + }, + "arrays": { + "patterns": [ + { + "name": "meta.structure.array.toon", + "begin": "\\[", + "end": "\\]", + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#strings" + }, + { + "include": "#numbers" + }, + { + "include": "#booleans" + }, + { + "include": "#null" + } + ] + } + ] + } + } +}