Skip to content

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

Open
chenwuji2000-cyber wants to merge 1 commit intozed-industries:mainfrom
chenwuji2000-cyber:fix/cpp-preprocessor-highlight-regression
Open

languages: Fix C/C++ preprocessor directive highlight regression#49031
chenwuji2000-cyber wants to merge 1 commit intozed-industries:mainfrom
chenwuji2000-cyber:fix/cpp-preprocessor-highlight-regression

Conversation

@chenwuji2000-cyber
Copy link
Contributor

@chenwuji2000-cyber chenwuji2000-cyber commented Feb 12, 2026

Summary

  • PR languages: Change syntax highlighting for C/C++ preprocessor directives #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

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

Release Notes:

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

🤖 Generated with Claude Code

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 12, 2026
@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Feb 12, 2026
Copy link
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should instead fix the highlights for the builtin themes here. Eventually (hopefully soon) we can add a fallback if preproc is not defined to keyword.preproc as defined here, but for now I think just fixing builtin themes is the better path. What do you think?

@MrSubidubi MrSubidubi self-assigned this Feb 12, 2026
PR zed-industries#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, causing `#include`, `#define`, etc.
to appear unhighlighted.

Update the `preproc` color in all builtin themes to match their
respective `keyword` color, restoring visible highlighting for
preprocessor directives.

Fixes zed-industries#49024

Release Notes:

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

Co-Authored-By: Claude <noreply@anthropic.com>
@chenwuji2000-cyber chenwuji2000-cyber force-pushed the fix/cpp-preprocessor-highlight-regression branch from 69a8574 to 974b2f2 Compare February 12, 2026 15:27
@zed-industries-bot
Copy link
Contributor

Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against 974b2f2

@chenwuji2000-cyber
Copy link
Contributor Author

Manual test passed. Buildin theme with different color.
c3b623c6c6aae279f60381dd5bed5a46
592b56c564c345ff2d46245a81f208b1
53752331a77a501eb61f94b74fef6d26
Side efffect for go language.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bad syntax highlighting for c++ includes

4 participants