mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
cpp: Improve syntax highlighting (#13922)
* Added some missing operators, delimeters and keywords * Highlight destructor, and operator overload as `@function` * Moved `(field_identifier)` to the top, as it was highlighting methods as `@property` There are still some problems with something like `n1::n2::foo(...)`, `foo` is not properly highlighted as a function Release Notes: - Improved C++ syntax highlighting
This commit is contained in:
parent
298ca5ff1b
commit
001376fd6d
@ -1,4 +1,5 @@
|
||||
(identifier) @variable
|
||||
(field_identifier) @property
|
||||
|
||||
(call_expression
|
||||
function: (qualified_identifier
|
||||
@ -30,6 +31,11 @@
|
||||
(function_declarator
|
||||
declarator: (field_identifier) @function)
|
||||
|
||||
(operator_name
|
||||
(identifier)? @operator) @function
|
||||
|
||||
(destructor_name (identifier) @function)
|
||||
|
||||
((namespace_identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
@ -39,11 +45,13 @@
|
||||
((identifier) @constant
|
||||
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
(field_identifier) @property
|
||||
(statement_identifier) @label
|
||||
(this) @variable.special
|
||||
("static_assert") @function.builtin
|
||||
|
||||
[
|
||||
"alignas"
|
||||
"alignof"
|
||||
"break"
|
||||
"case"
|
||||
"catch"
|
||||
@ -51,9 +59,10 @@
|
||||
"co_await"
|
||||
"co_return"
|
||||
"co_yield"
|
||||
"const"
|
||||
"concept"
|
||||
"constexpr"
|
||||
"continue"
|
||||
"decltype"
|
||||
"default"
|
||||
"delete"
|
||||
"do"
|
||||
@ -65,9 +74,7 @@
|
||||
"for"
|
||||
"friend"
|
||||
"if"
|
||||
"if"
|
||||
"inline"
|
||||
"mutable"
|
||||
"namespace"
|
||||
"new"
|
||||
"noexcept"
|
||||
@ -75,9 +82,9 @@
|
||||
"private"
|
||||
"protected"
|
||||
"public"
|
||||
"requires"
|
||||
"return"
|
||||
"sizeof"
|
||||
"static"
|
||||
"struct"
|
||||
"switch"
|
||||
"template"
|
||||
@ -87,10 +94,10 @@
|
||||
"typename"
|
||||
"union"
|
||||
"using"
|
||||
"volatile"
|
||||
"while"
|
||||
(primitive_type)
|
||||
(sized_type_specifier)
|
||||
(storage_class_specifier)
|
||||
(type_qualifier)
|
||||
(virtual)
|
||||
] @keyword
|
||||
@ -126,7 +133,9 @@
|
||||
] @string
|
||||
|
||||
[
|
||||
"."
|
||||
","
|
||||
":"
|
||||
"::"
|
||||
";"
|
||||
] @punctuation.delimiter
|
||||
|
||||
@ -140,20 +149,47 @@
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"--"
|
||||
"."
|
||||
".*"
|
||||
"->*"
|
||||
"~"
|
||||
"-"
|
||||
"--"
|
||||
"-="
|
||||
"->"
|
||||
"="
|
||||
"!"
|
||||
"!="
|
||||
"*"
|
||||
"|"
|
||||
"|="
|
||||
"||"
|
||||
"^"
|
||||
"^="
|
||||
"&"
|
||||
"&="
|
||||
"&&"
|
||||
"+"
|
||||
"++"
|
||||
"+="
|
||||
"*"
|
||||
"*="
|
||||
"/"
|
||||
"/="
|
||||
"%"
|
||||
"%="
|
||||
"<<"
|
||||
"<<="
|
||||
">>"
|
||||
">>="
|
||||
"<"
|
||||
"=="
|
||||
">"
|
||||
"<="
|
||||
">="
|
||||
"<=>"
|
||||
"||"
|
||||
"?"
|
||||
] @operator
|
||||
|
||||
(conditional_expression ":" @operator)
|
||||
(user_defined_literal (literal_suffix) @operator)
|
||||
|
Loading…
Reference in New Issue
Block a user