Basic syntax highlighting and file recognition#5
Basic syntax highlighting and file recognition#5VishalRaut2106 wants to merge 3 commits intotoon-format:mainfrom
Conversation
- TypeScript setup with strict type checking - ESLint + formatting configured - Build pipeline (pnpm build, pnpm dev) - Basic extension scaffolding with hello command - Ready for collaborative development Follows roadmap: - v0.0.x - Initial project setup ✅ - v0.1.x - Basic syntax highlighting (planned) - v0.2.x - Format validation (planned) - v0.3.x - Code formatting and auto-completion (planned) - v1.0.0 - First stable release (planned)
- Add TextMate grammar for TOON syntax highlighting with support for comments, strings, numbers, booleans, null values, keys, and arrays - Add language configuration with line comments, bracket matching, auto-closing pairs, and indentation rules - Register `.toon` file extension with VS Code language system - Add basic example file demonstrating TOON syntax features - Update package.json to version 0.1.0 and include language and grammar contributions - Update README.md with features section, example code, and roadmap progress - Update CHANGELOG.md with v0.1.0 release notes
johannschopplich
left a comment
There was a problem hiding this comment.
Thanks for putting this together! The extension scaffolding, package.json wiring, CI, and release workflow are all solid and reusable. The grammar needs some significant work before we can merge, though.
Spec issue: no comment syntax in TOON
The spec explicitly states that TOON has no comment syntax (called out in the intro, the YAML comparison, and the strict mode error list). The #.*$ pattern and "lineComment": "#" should be removed. A # in a TOON document is a string value, not a comment.
Example file uses YAML syntax, not TOON
hobbies: [reading, coding, hiking] is YAML-style. The TOON equivalent is hobbies[3]: reading,coding,hiking.
Missing: array header syntax
The most distinctive TOON construct (key[N]: and key[N]{f1,f2}:) isn't matched by the current key regex, which breaks when [N] or {fields} appears between the key and the colon. Array headers, tabular headers, and their value rows all end up unstyled.
Other gaps worth addressing:
- Dotted keys (
user.name) don't match (missing.in the character class) - List item markers (
-) are unstyled (and)in language-configuration have no basis in the spec#commentsis ordered before#strings, so#inside a quoted string incorrectly gets comment scope
I'd suggest going through the spec (§5, §6, §7, §9) before reworking the grammar, especially the array header syntax. Happy to answer any questions about the spec along the way!
🎨 Overview
Implements v0.1.0 with complete syntax highlighting and file recognition for TOON files.
✅ What's Added
.toonextension support with proper language ID🌈 Syntax Support
#)📋 Roadmap Progress
🧪 Testing
pnpm build)pnpm lint).toonextension🚀 Ready For
📝 Files Changed
package.json- Added language and grammar contributionslanguage-configuration.json- Language settings and indentation rulessyntaxes/toon.tmLanguage.json- Complete TextMate grammarexamples/basic.toon- Example TOON file for testingREADME.md&CHANGELOG.md- Updated documentation