languages: Change syntax highlighting for C/C++ preprocessor directives#48109
Merged
osiewicz merged 1 commit intozed-industries:mainfrom Feb 10, 2026
Merged
Conversation
Member
|
Cheers |
chenwuji2000-cyber
added a commit
to chenwuji2000-cyber/zed
that referenced
this pull request
Feb 12, 2026
PR zed-industries#48109 changed the capture name for C/C++ preprocessor directives from `@keyword.directive` to `@preproc`. While semantically reasonable, this caused an unintended side effect: most built-in themes define `preproc` with colors nearly indistinguishable from plain text, making `#include`, `#define`, etc. appear unhighlighted. This commit uses `@keyword.preproc` instead, which both preserves the semantic distinction (preprocessor directives ≠ language keywords) and leverages HighlightMap's partial matching to fall back to the `keyword` style — restoring visible highlighting across all themes without any theme changes. Fixes zed-industries#49024 Release Notes: - Fixed C/C++ preprocessor directives (`#include`, `#define`, etc.) appearing unhighlighted in most themes. Co-Authored-By: Claude <noreply@anthropic.com>
4 tasks
chenwuji2000-cyber
added a commit
to chenwuji2000-cyber/zed
that referenced
this pull request
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changes the highlight capture for preprocessor directives from
@keyword.directiveto@preprocin both C and C++.PR #44043 changed C from
@keywordto@keyword.directivefor consistency with C++, but@keyword.directiveis still semantically wrong. Preprocessor directives are not language keywords — they are instructions to a separate preprocessing phase that runs before compilation.Using
@preprocreflects this distinction and allows themes to style them independently from actual language keywords likeconst,struct,if, etc. This is consistent with how editors like CLion handle preprocessor directives.Before:

After:

Release Notes: