Skip to content

Conversation

@crhntr
Copy link
Member

@crhntr crhntr commented Jan 16, 2026

I'd like to start exploring more editor support for muxt GoHTML templates. I think there is value in "just using html/template" so that folks see that muxt does not extend the actual syntax of the standard library but it would be nice to have more helpful completions and type inference for better completions. This was an exercise in having Claude Code generate something for me.

Related to: #57

@claude
Copy link

claude bot commented Jan 16, 2026

Pull Request Review: Editor Syntax Highlighting Support

This PR adds TextMate grammar support for .gohtml files with muxt route patterns. This is a valuable addition for developer experience!

Strengths

  1. Well-structured grammar files: Clean separation between gotemplate.tmLanguage.json (core template syntax) and gohtml.tmLanguage.json (HTML + templates + muxt patterns).

  2. Comprehensive muxt pattern support: Correctly handles HTTP methods, path parameters, status codes, and method calls.

  3. Good documentation: Clear installation instructions for VS Code, Zed, Sublime, and TextMate.

  4. Proper scope naming: Uses standard TextMate naming conventions.

Issues and Suggestions

1. Status Code Regex May Match Unwanted Numbers (Medium Priority)

Location: editor/syntaxes/gohtml.tmLanguage.json:78

The regex pattern may incorrectly highlight numbers in method calls. For example, in GetUser(123), the 123 could be highlighted as an HTTP status code instead of a method argument.

Suggested fix: Tighten the regex to only match status codes in appropriate positions within the template name string.

2. Testing and Validation (Important)

No automated tests for the grammar files. Consider adding:

  • Sample .gohtml files in editor/test-fixtures/
  • JSON syntax validation script
  • Documentation on manual testing

Security Review

No concerns. Grammar files are static JSON.

Overall Assessment

This is a solid first implementation that adds real value. The grammar correctly handles common patterns with good documentation.

Recommendation: Approve with minor suggestions

The issues are minor and do not block merging. The status code regex is the main item worth addressing.

Next Steps (Optional)

  1. Add snippets for common muxt patterns
  2. Consider LSP support for type checking and auto-completion
  3. Publish to VS Code marketplace

Great work on this exploratory PR!

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.

1 participant