Skip to content

Commit

Permalink
Improve C and C++ syntax highlighting (#25325)
Browse files Browse the repository at this point in the history
Release Notes:

  - Improved C and C++ syntax highlighting.

| Zed 0.174.6 | With this PR |
| --- | --- |
|
![Image](https://github.com/user-attachments/assets/fa5bf2e0-c682-4e6a-ab64-bb873579d47c)
|
![Image](https://github.com/user-attachments/assets/dc980de9-cd6a-4b0b-8ddc-ac705f687910)
|

- `NULL`, `nullptr`: `constant` -> `constant.builtin`

```cpp
#include <stdbool.h>
int a[] = {true, false};
const int * IDENTIFIER = nullptr;
```

---------

Co-authored-by: Marshall Bowers <[email protected]>
  • Loading branch information
chbk and maxdeviant authored Feb 21, 2025
1 parent 7deceb6 commit 144d8a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/languages/src/c/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
(false)
] @boolean

(null) @constant
(null) @constant.builtin

(identifier) @variable

Expand Down
2 changes: 1 addition & 1 deletion crates/languages/src/cpp/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ type :(primitive_type) @type.primitive
[
(null)
("nullptr")
] @constant
] @constant.builtin

(number_literal) @number

Expand Down

0 comments on commit 144d8a1

Please sign in to comment.