Commit 2111bd4
Highlight .sx on GitHub as Rust, not TypeScript
The previous mapping picked TypeScript because SxfeScript is JavaScript plus
erasable type annotations. That covered the JavaScript half but left the half
the language is actually named for unhighlighted: `mut`, `&mut`, and `unsafe`
all rendered as plain identifiers, which is the opposite of the emphasis the
source intends.
Both grammars were rendered on github.com from pushed branches and compared
token by token, using perturbed file contents so the blob highlight cache did
not serve one branch's colors for the other.
Rust highlights, TypeScript does not:
- `mut` in `let mut` keyword
- `mut` in `bump(&mut counter)` keyword
- `unsafe extern` keyword
- `Repo`, `Counter`, `Request` type color
TypeScript highlights, Rust does not:
- `interface`, `function`, `void` keyword
- template-literal text string color
Shared by both: `const`, `let`, `if`, `return`, `async`, `await`, `new`,
string literals, numbers, comments, and function-call names.
Across the 19 `.sx` files in the repository `mut` appears 15 times against 7
`function`, 5 `interface`, and 2 `void`, so the Rust mapping colors more of
what matters and the tokens it drops stay legible as plain identifiers.
`safe` is a keyword under neither grammar.
Rendering on github.com is the only thing this changes. The repository
language statistics will now count `.sx` as Rust instead of TypeScript.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 895d60b commit 2111bd4
1 file changed
Lines changed: 14 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
0 commit comments