Files
oak-gpui/crates/languages/src/cpp/highlights.scm
T
Caio Piccirillo abd6009b41 Enhance syntax highlight for C++20 keywords (#36817)
Closes #36439 and #32999 

## C++20 modules:
Before (Zed Preview v0.201.3):
<img width="1048" height="704" alt="image"
src="https://github.com/user-attachments/assets/8eaaf77f-4e27-4a5a-9e87-4e5ba7293990"
/>
After:
<img width="1048" height="704" alt="image"
src="https://github.com/user-attachments/assets/df8d0b2c-f2d0-4b0e-9a52-495e6be5a8c0"
/>

## C++20 coroutines:
Before (Zed Preview v0.201.3):
<img width="1048" height="704" alt="image"
src="https://github.com/user-attachments/assets/652191ec-a653-444d-a239-da3e4e4b661e"
/>
After:
<img width="1048" height="704" alt="image"
src="https://github.com/user-attachments/assets/36947eb5-8997-483a-b36c-8af84872b158"
/>

## Logical operators:
Before (Zed Preview v0.201.3):
<img width="511" height="102" alt="image"
src="https://github.com/user-attachments/assets/9bf95bac-b076-4edd-a1f3-c3dfee98c2fd"
/>

After:
<img width="511" height="102" alt="image"
src="https://github.com/user-attachments/assets/82c7564d-b94d-41f5-9c48-e39fe3ba3b3e"
/>

## Operator keyword:
Before (Zed Preview v0.201.3):
<img width="591" height="381" alt="image"
src="https://github.com/user-attachments/assets/1d9dad05-2d86-4566-97f4-aff440dcd1df"
/>

After:
<img width="591" height="381" alt="image"
src="https://github.com/user-attachments/assets/a1ca289a-8a5d-4ffd-96db-0d511405da4b"
/>

## Goto:
Before (Zed Preview v0.201.3):
<img width="610" height="430" alt="image"
src="https://github.com/user-attachments/assets/2d00382b-d1ad-4e36-a3ee-88e06ec528ed"
/>

After:
<img width="610" height="430" alt="image"
src="https://github.com/user-attachments/assets/de887b21-66f0-4a70-9ed2-e18dbb3c81c9"
/>

Release Notes:

- Enhance keyword highlighting for C++
2025-08-27 04:31:57 +00:00

274 lines
3.8 KiB
Scheme

(identifier) @variable
(field_identifier) @property
(namespace_identifier) @namespace
(concept_definition
name: (identifier) @concept)
(requires_clause
constraint: (template_type
name: (type_identifier) @concept))
(module_name
(identifier) @module)
(module_declaration
name: (module_name
(identifier) @module))
(import_declaration
name: (module_name
(identifier) @module))
(import_declaration
partition: (module_partition
(module_name
(identifier) @module)))
(call_expression
function: (qualified_identifier
name: (identifier) @function))
(call_expression
(qualified_identifier
(identifier) @function.call))
(call_expression
(qualified_identifier
(qualified_identifier
(identifier) @function.call)))
(call_expression
(qualified_identifier
(qualified_identifier
(qualified_identifier
(identifier) @function.call))))
((qualified_identifier
(qualified_identifier
(qualified_identifier
(qualified_identifier
(identifier) @function.call)))) @_parent
(#has-ancestor? @_parent call_expression))
(call_expression
function: (identifier) @function)
(call_expression
function: (field_expression
field: (field_identifier) @function))
(preproc_function_def
name: (identifier) @function.special)
(template_function
name: (identifier) @function)
(template_method
name: (field_identifier) @function)
(function_declarator
declarator: (identifier) @function)
(function_declarator
declarator: (qualified_identifier
name: (identifier) @function))
(function_declarator
declarator: (field_identifier) @function)
(operator_name
(identifier)? @operator) @function
(operator_name
"<=>" @operator.spaceship)
(destructor_name (identifier) @function)
((namespace_identifier) @type
(#match? @type "^[A-Z]"))
(auto) @type
(type_identifier) @type
type: (primitive_type) @type.builtin
(sized_type_specifier) @type.builtin
(attribute
name: (identifier) @attribute)
((identifier) @constant.builtin
(#match? @constant.builtin "^_*[A-Z][A-Z\\d_]*$"))
(statement_identifier) @label
(this) @variable.builtin
("static_assert") @function.builtin
[
"alignas"
"alignof"
"break"
"case"
"catch"
"class"
"co_await"
"co_return"
"co_yield"
"concept"
"consteval"
"constexpr"
"constinit"
"continue"
"decltype"
"default"
"delete"
"do"
"else"
"enum"
"explicit"
"export"
"extern"
"final"
"for"
"friend"
"goto"
"if"
"import"
"inline"
"module"
"namespace"
"new"
"noexcept"
"operator"
"override"
"private"
"protected"
"public"
"requires"
"return"
"sizeof"
"struct"
"switch"
"template"
"thread_local"
"throw"
"try"
"typedef"
"typename"
"union"
"using"
"virtual"
"while"
(storage_class_specifier)
(type_qualifier)
] @keyword
[
"#define"
"#elif"
"#else"
"#endif"
"#if"
"#ifdef"
"#ifndef"
"#include"
(preproc_directive)
] @keyword.directive
(comment) @comment
[
(true)
(false)
] @boolean
[
(null)
("nullptr")
] @constant.builtin
(number_literal) @number
[
(string_literal)
(system_lib_string)
(char_literal)
(raw_string_literal)
] @string
[
","
":"
"::"
";"
(raw_string_delimiter)
] @punctuation.delimiter
[
"{"
"}"
"("
")"
"["
"]"
] @punctuation.bracket
[
"."
".*"
"->*"
"~"
"-"
"--"
"-="
"->"
"="
"!"
"!="
"|"
"|="
"||"
"^"
"^="
"&"
"&="
"&&"
"+"
"++"
"+="
"*"
"*="
"/"
"/="
"%"
"%="
"<<"
"<<="
">>"
">>="
"<"
"=="
">"
"<="
">="
"?"
"and"
"and_eq"
"bitand"
"bitor"
"compl"
"not"
"not_eq"
"or"
"or_eq"
"xor"
"xor_eq"
] @operator
"<=>" @operator.spaceship
(binary_expression
operator: "<=>" @operator.spaceship)
(conditional_expression ":" @operator)
(user_defined_literal (literal_suffix) @operator)