Unnamed repository; edit this file 'description' to name the repository.
C++: Improve parameter highlighting
This adds parameter highlighting for reference parameters and defaulted parameters. For example: ```cpp auto strip_prefix_only(std::string& s, Hidden_Homonym skip_hidden_homonym = {}) const -> Affixing_Result<Prefix>; ``` Previously both parameters were only highlighted as variables.
Michael Davis 2024-03-21
parent c099dde · commit f5d95de
-rw-r--r--runtime/queries/cpp/highlights.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/queries/cpp/highlights.scm b/runtime/queries/cpp/highlights.scm
index 509dcdf7..c1d14a0b 100644
--- a/runtime/queries/cpp/highlights.scm
+++ b/runtime/queries/cpp/highlights.scm
@@ -49,6 +49,13 @@
(this) @variable.builtin
(nullptr) @constant.builtin
+; Parameters
+
+(parameter_declaration
+ declarator: (reference_declarator (identifier) @variable.parameter))
+(optional_parameter_declaration
+ declarator: (identifier) @variable.parameter)
+
; Keywords
(template_argument_list (["<" ">"] @punctuation.bracket))