Files
carbon-lang/utils/textmate
ÖzgürandDana Jansens 2184663511 Improve vscode syntax highlighting (#6543)
This PR improves the vscode syntax highlighting.

- Added `comment` keys.
- Added highlighting of invalid numbers such as `0x`, `0b`, `0xa`, etc.
- Restricted highlighting of numeric type literals to common types to
avoid highlighting identifiers such as `i1`.
- Changed the highlighting of named operators (e.g., `as`).
- Added `char` and `str` to type literals.
- Added `const` to modifier keywords.
- Removed `addr` keyword.
- Refactored some rules to use `begin`/`end` to handle line breaks.
- Added highlighting to `choice` values as `enum` values.
- Updated the rules for matching `types`.
- Added highlighting to rhs of `adapt`, `alias`, `choice`, `constraint`,
`impl`, `interface`, `as`, and `impls`.
    - Added highlighting to rhs of bindings.
    - Added highlighting to function return types.
- Updated the rules for matching `functions`.
- Updated the rules for matching `variables`.
- Added highlighting unidentified words as `variable`. 
- Added examples and before/after screenshots.

| Before | After |
| :---: | :---: |
| <img width="424" alt="before"
src="https://github.com/user-attachments/assets/e84d0ff9-237b-40c2-845b-ec550b8f7bea">
| <img width="431" alt="now"
src="https://github.com/user-attachments/assets/2c18640b-318a-4cd5-952c-bad61d3fdbca">
|

---------

Co-authored-by: Dana Jansens <danakj@orodu.net>
2026-02-13 16:50:18 +00:00
..
2022-08-25 08:56:46 -07:00
2023-08-23 05:07:48 +00:00

Textmate Language Definition

This directory contains a TextMate bundle which can be used in various editors such as TextMate, Atom, or the IntelliJ family for syntax highlighting of Carbon source files.

If you are using TextMate, see the documentation on how to install TextMate bundles. Clone the repository with Git and symlink/copy the utils/textmate directory to any of the paths TextMate will search through (you can find these paths in the TextMate documentation above).

IntelliJ

If you are using IntelliJ or a IntelliJ Platform product, you can find documentation on how to install TextMate bundles in IntelliJ. Clone the repository with Git and open the utils/textmate directory inside the IntelliJ TextMate Bundle window.

Atom

If you are using Atom, you can convert the bundle to an Atom-compatible one. See the Atom documentation on how to do that.

Other

For other editors that support TextMate bundles you can consult your editors documentation to see how to use the bundle.