languages: Fix C/C++ preprocessor directive highlight regression (#49031)

## Summary

- PR #48109 changed the capture name for C/C++ preprocessor directives
from `@keyword.directive` to `@preproc`. While semantically correct, the
builtin themes had `preproc` defined with colors nearly
indistinguishable from plain text (e.g. One Dark `#dce0e5ff`, Ayu Dark
`#bfbdb6ff`), making `#include`, `#define`, etc. appear unhighlighted.
- This PR updates the `preproc` color in all builtin themes (and the
fallback theme) to match their respective `keyword` color, restoring
visible highlighting for preprocessor directives.

Fixes #49024

## Side effects

- Go uses `@preproc` for `//go:` and `// +build` compiler directives.
These will also change from the previous muted gray to the keyword
color. This is arguably an improvement — compiler directives are special
constructs that benefit from visible highlighting, consistent with how
other editors (CLion, VS Code) handle them.

## Test plan

- [x] `cargo test -p language highlight_map` passes
- [x] Open a C/C++ file and verify `#include`, `#define`, `#ifdef`, etc.
are highlighted with the keyword color
- [x] Verify across multiple builtin themes (One Dark, Ayu Dark, Gruvbox
Dark, etc.)
- [x] Open a Go file and verify `//go:` directives are highlighted
reasonably

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Release Notes:

- Fixed C/C++ preprocessor directives (`#include`, `#define`, etc.)
appearing unhighlighted in builtin themes.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: MrSubidubi <finn@zed.dev>
This commit is contained in:
authored and GitHub committed 2026-04-02 13:24:15 +00:00
1 parent 2a0fd2c3ac
commit d7e38abdf7
6 files changed
+14 -14

No files matched your search

+3 -3
View File
@@ -283,7 +283,7 @@
"font_weight": null
},
"preproc": {
"color": "#bfbdb6ff",
"color": "#ff8f3fff",
"font_style": null,
"font_weight": null
},
@@ -685,7 +685,7 @@
"font_weight": null
},
"preproc": {
"color": "#5c6166ff",
"color": "#fa8d3eff",
"font_style": null,
"font_weight": null
},
@@ -1087,7 +1087,7 @@
"font_weight": null
},
"preproc": {
"color": "#cccac2ff",
"color": "#ffad65ff",
"font_style": null,
"font_weight": null
},
+6 -6
View File
@@ -293,7 +293,7 @@
"font_weight": null
},
"preproc": {
"color": "#fbf1c7ff",
"color": "#fb4833ff",
"font_style": null,
"font_weight": null
},
@@ -710,7 +710,7 @@
"font_weight": null
},
"preproc": {
"color": "#fbf1c7ff",
"color": "#fb4833ff",
"font_style": null,
"font_weight": null
},
@@ -1127,7 +1127,7 @@
"font_weight": null
},
"preproc": {
"color": "#fbf1c7ff",
"color": "#fb4833ff",
"font_style": null,
"font_weight": null
},
@@ -1544,7 +1544,7 @@
"font_weight": null
},
"preproc": {
"color": "#282828ff",
"color": "#9d0006ff",
"font_style": null,
"font_weight": null
},
@@ -1961,7 +1961,7 @@
"font_weight": null
},
"preproc": {
"color": "#282828ff",
"color": "#9d0006ff",
"font_style": null,
"font_weight": null
},
@@ -2378,7 +2378,7 @@
"font_weight": null
},
"preproc": {
"color": "#282828ff",
"color": "#9d0006ff",
"font_style": null,
"font_weight": null
},
+2 -2
View File
@@ -290,7 +290,7 @@
"font_weight": null
},
"preproc": {
"color": "#dce0e5ff",
"color": "#b477cfff",
"font_style": null,
"font_weight": null
},
@@ -702,7 +702,7 @@
"font_weight": null
},
"preproc": {
"color": "#242529ff",
"color": "#a449abff",
"font_style": null,
"font_weight": null
},
+1 -1
View File
@@ -38,7 +38,7 @@
"#ifndef"
"#include"
(preproc_directive)
] @preproc
] @keyword.preproc @preproc
[
"="
+1 -1
View File
@@ -196,7 +196,7 @@ type: (primitive_type) @type.builtin
"#ifndef"
"#include"
(preproc_directive)
] @preproc
] @keyword.preproc @preproc
(comment) @comment
+1 -1
View File
@@ -357,7 +357,7 @@ pub(crate) fn zed_default_dark() -> Theme {
("number".into(), orange.into()),
("operator".into(), HighlightStyle::default()),
("predictive".into(), HighlightStyle::default()),
("preproc".into(), HighlightStyle::default()),
("preproc".into(), purple.into()),
("primary".into(), HighlightStyle::default()),
("property".into(), red.into()),
("punctuation".into(), HighlightStyle::default()),