From b4a03989b1c5a91b1902c6b75b7766107e1477b9 Mon Sep 17 00:00:00 2001 From: Ben Kunkle Date: Tue, 27 May 2025 11:05:53 -0500 Subject: [PATCH] javascript/typescript/tsx: Highlight private properties (#31527) Closes #28411 Release Notes: - Fixed the lack of highlighting for private properties in classes for JavaScript/TypeScript/TSX files --- crates/languages/src/javascript/highlights.scm | 11 ++++++----- crates/languages/src/tsx/highlights.scm | 11 ++++++----- crates/languages/src/typescript/highlights.scm | 11 ++++++----- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/crates/languages/src/javascript/highlights.scm b/crates/languages/src/javascript/highlights.scm index 685bdba3c5284226d90eadb0bca5874d946df3f9..73cb1a5e45b2c396d2c5d09fe4e3a76dce15d050 100644 --- a/crates/languages/src/javascript/highlights.scm +++ b/crates/languages/src/javascript/highlights.scm @@ -7,6 +7,7 @@ (property_identifier) @property (shorthand_property_identifier) @property (shorthand_property_identifier_pattern) @property +(private_property_identifier) @property ; Function and method calls @@ -15,7 +16,7 @@ (call_expression function: (member_expression - property: (property_identifier) @function.method)) + property: [(property_identifier) (private_property_identifier)] @function.method)) ; Function and method definitions @@ -24,18 +25,18 @@ (function_declaration name: (identifier) @function) (method_definition - name: (property_identifier) @function.method) + name: [(property_identifier) (private_property_identifier)] @function.method) (method_definition name: (property_identifier) @constructor (#eq? @constructor "constructor")) (pair - key: (property_identifier) @function.method + key: [(property_identifier) (private_property_identifier)] @function.method value: [(function_expression) (arrow_function)]) (assignment_expression left: (member_expression - property: (property_identifier) @function.method) + property: [(property_identifier) (private_property_identifier)] @function.method) right: [(function_expression) (arrow_function)]) (variable_declarator @@ -248,4 +249,4 @@ (jsx_closing_element ([""]) @punctuation.bracket.jsx) (jsx_self_closing_element (["<" "/>"]) @punctuation.bracket.jsx) (jsx_attribute "=" @punctuation.delimiter.jsx) -(jsx_text) @text.jsx +(jsx_text) @text.jsx \ No newline at end of file diff --git a/crates/languages/src/tsx/highlights.scm b/crates/languages/src/tsx/highlights.scm index 9a707fa0cebbee1fce3001e8b7b57875326702d3..e2837c61fda49e546da7fc17c2a538a5243ec4a6 100644 --- a/crates/languages/src/tsx/highlights.scm +++ b/crates/languages/src/tsx/highlights.scm @@ -7,6 +7,7 @@ (property_identifier) @property (shorthand_property_identifier) @property (shorthand_property_identifier_pattern) @property +(private_property_identifier) @property ; Function and method calls @@ -15,7 +16,7 @@ (call_expression function: (member_expression - property: (property_identifier) @function.method)) + property: [(property_identifier) (private_property_identifier)] @function.method)) ; Function and method definitions @@ -24,18 +25,18 @@ (function_declaration name: (identifier) @function) (method_definition - name: (property_identifier) @function.method) + name: [(property_identifier) (private_property_identifier)] @function.method) (method_definition name: (property_identifier) @constructor (#eq? @constructor "constructor")) (pair - key: (property_identifier) @function.method + key: [(property_identifier) (private_property_identifier)] @function.method value: [(function_expression) (arrow_function)]) (assignment_expression left: (member_expression - property: (property_identifier) @function.method) + property: [(property_identifier) (private_property_identifier)] @function.method) right: [(function_expression) (arrow_function)]) (variable_declarator @@ -254,4 +255,4 @@ (jsx_closing_element ([""]) @punctuation.bracket.jsx) (jsx_self_closing_element (["<" "/>"]) @punctuation.bracket.jsx) (jsx_attribute "=" @punctuation.delimiter.jsx) -(jsx_text) @text.jsx +(jsx_text) @text.jsx \ No newline at end of file diff --git a/crates/languages/src/typescript/highlights.scm b/crates/languages/src/typescript/highlights.scm index 9c7289bd0f397e03aff0e8b7398472780f5e3458..486e5a76845806afff0fc01cebcee847f0c65e63 100644 --- a/crates/languages/src/typescript/highlights.scm +++ b/crates/languages/src/typescript/highlights.scm @@ -39,6 +39,7 @@ (property_identifier) @property (shorthand_property_identifier) @property (shorthand_property_identifier_pattern) @property +(private_property_identifier) @property ; Function and method calls @@ -47,7 +48,7 @@ (call_expression function: (member_expression - property: (property_identifier) @function.method)) + property: [(property_identifier) (private_property_identifier)] @function.method)) ; Function and method definitions @@ -56,18 +57,18 @@ (function_declaration name: (identifier) @function) (method_definition - name: (property_identifier) @function.method) + name: [(property_identifier) (private_property_identifier)] @function.method) (method_definition name: (property_identifier) @constructor (#eq? @constructor "constructor")) (pair - key: (property_identifier) @function.method + key: [(property_identifier) (private_property_identifier)] @function.method value: [(function_expression) (arrow_function)]) (assignment_expression left: (member_expression - property: (property_identifier) @function.method) + property: [(property_identifier) (private_property_identifier)] @function.method) right: [(function_expression) (arrow_function)]) (variable_declarator @@ -270,4 +271,4 @@ "while" "with" "yield" -] @keyword +] @keyword \ No newline at end of file