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
This commit is contained in:
parent
19b6892c8d
commit
b4a03989b1
3 changed files with 18 additions and 15 deletions
|
@ -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
|
|
@ -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
|
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue