Skip to content

Basic syntax highlighting and file recognition#5

Open
VishalRaut2106 wants to merge 3 commits intotoon-format:mainfrom
VishalRaut2106:main
Open

Basic syntax highlighting and file recognition#5
VishalRaut2106 wants to merge 3 commits intotoon-format:mainfrom
VishalRaut2106:main

Conversation

@VishalRaut2106
Copy link

🎨 Overview

Implements v0.1.0 with complete syntax highlighting and file recognition for TOON files.

✅ What's Added

  • Syntax highlighting - Complete TextMate grammar for TOON syntax
  • File recognition - .toon extension support with proper language ID
  • Language config - Indentation rules, brackets, auto-closing pairs
  • Example file - Basic TOON syntax demonstration

🌈 Syntax Support

  • Comments (#)
  • Strings (quoted and unquoted)
  • Numbers, booleans, null values
  • Object keys and nested structures
  • Array syntax with brackets

📋 Roadmap Progress

  • v0.0.x - Initial project setup ✅
  • v0.1.x - Basic syntax highlighting ✅ (this PR)
  • v0.2.x - Format validation (next)
  • v0.3.x - Code formatting and auto-completion (planned)
  • v1.0.0 - First stable release (planned)

🧪 Testing

  • Builds successfully (pnpm build)
  • Passes all ESLint rules (pnpm lint)
  • Syntax highlighting works for all TOON elements
  • File recognition with .toon extension
  • Proper indentation and bracket matching

🚀 Ready For

  • User testing with TOON files
  • Next phase: v0.2.x validation implementation
  • Community feedback on syntax highlighting

📝 Files Changed

  • package.json - Added language and grammar contributions
  • language-configuration.json - Language settings and indentation rules
  • syntaxes/toon.tmLanguage.json - Complete TextMate grammar
  • examples/basic.toon - Example TOON file for testing
  • README.md & CHANGELOG.md - Updated documentation

- 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
Copy link
Contributor

@johannschopplich johannschopplich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
  • #comments is 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants