Highlight .sx on GitHub as TypeScript - #1
Merged
Merged
Conversation
GitHub Linguist has no entry for the `.sx` extension, so every SxfeScript file in the repository renders as unhighlighted plain text and is left out of the language statistics. Map the extension to TypeScript in .gitattributes. Of the grammars Linguist ships, TypeScript is the closest fit: SxfeScript is JavaScript plus erasable `:` type annotations, so declarations, strings, comments, numbers, regexes, template literals, and annotations all highlight correctly. The tokens it does not know are `let mut`, `&mut`, and `unsafe`, which fall back to plain identifier styling rather than breaking the rest of the line. This only affects rendering on github.com. The build, the tests, and the VS Code extension in tooling/vscode -- which has the real SxfeScript grammar -- are untouched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Linguist has no entry for the
.sxextension, so every SxfeScriptfile in the repository renders as unhighlighted plain text and is left out
of the language statistics.
This maps the extension to TypeScript in
.gitattributes. Of the grammarsLinguist ships, TypeScript is the closest fit: SxfeScript is JavaScript plus
erasable
:type annotations, so declarations, strings, comments, numbers,template literals, and annotations all highlight correctly. The tokens it does
not know are
let mut,&mut, andunsafe, which fall back to plainidentifier styling rather than breaking the rest of the line.
Verified on
examples/hello.sxrendered from a pushed branch:letandfunctionhighlight as keywords,mutrenders as a plain identifier, and the&in&mutrenders as an operator. No line loses its highlighting.This only affects rendering on github.com. The build, the tests, and the
VS Code extension in
tooling/vscode-- which carries the real SxfeScriptgrammar at
syntaxes/sxfe.tmLanguage.json-- are untouched.🤖 Generated with Claude Code