Commit 303d43d
feat: add keyword subcategories to Ruby highlights (#275)
## Summary
Splits the monolithic `@keyword` capture in Ruby's `highlights.scm` into
semantic subcategories, enabling themes to style different keyword types
independently.
### New captures
| Capture | Keywords |
|---------|----------|
| `@keyword.function` | `class`, `def`, `module` |
| `@keyword.control.conditional` | `if`, `elsif`, `else`, `unless`,
`case`, `when`, `then` |
| `@keyword.control.repeat` | `while`, `until`, `for`, `do` |
| `@keyword.control.return` | `return`, `next`, `break`, `retry`,
`yield` |
| `@keyword.exception` | `begin`, `ensure`, `rescue` (alongside existing
`raise`/`fail`/`catch`/`throw`) |
| `@keyword` | `alias`, `and`, `end`, `in`, `or` (general/structural) |
### Backward compatibility
Fully backward compatible — themes that only define `keyword` will
continue to work via Zed's fallback resolution (e.g.
`keyword.control.return` → `keyword.control` → `keyword`).
### Precedent
Follows the pattern already established by the SCSS extension, which
uses `keyword.control.conditional`, `keyword.control.return`,
`keyword.function`, and `keyword.repeat`.
### Motivation
Currently it's impossible to visually distinguish `return`/`yield` from
`def`/`end` or `if`/`unless` in Ruby. This is a common theme
customisation need — other editors (VS Code, Sublime) support this level
of granularity. This change brings Ruby in line with other Zed language
extensions that already provide keyword subcategories.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 0b2935f commit 303d43d
1 file changed
Lines changed: 38 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 9 | | |
15 | 10 | | |
16 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 19 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | 20 | | |
31 | 21 | | |
32 | | - | |
33 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
34 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
36 | 56 | | |
37 | 57 | | |
38 | 58 | | |
| |||
0 commit comments