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
|
(property_identifier) @property
|
||||||
(shorthand_property_identifier) @property
|
(shorthand_property_identifier) @property
|
||||||
(shorthand_property_identifier_pattern) @property
|
(shorthand_property_identifier_pattern) @property
|
||||||
|
(private_property_identifier) @property
|
||||||
|
|
||||||
; Function and method calls
|
; Function and method calls
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (member_expression
|
function: (member_expression
|
||||||
property: (property_identifier) @function.method))
|
property: [(property_identifier) (private_property_identifier)] @function.method))
|
||||||
|
|
||||||
; Function and method definitions
|
; Function and method definitions
|
||||||
|
|
||||||
|
@ -24,18 +25,18 @@
|
||||||
(function_declaration
|
(function_declaration
|
||||||
name: (identifier) @function)
|
name: (identifier) @function)
|
||||||
(method_definition
|
(method_definition
|
||||||
name: (property_identifier) @function.method)
|
name: [(property_identifier) (private_property_identifier)] @function.method)
|
||||||
(method_definition
|
(method_definition
|
||||||
name: (property_identifier) @constructor
|
name: (property_identifier) @constructor
|
||||||
(#eq? @constructor "constructor"))
|
(#eq? @constructor "constructor"))
|
||||||
|
|
||||||
(pair
|
(pair
|
||||||
key: (property_identifier) @function.method
|
key: [(property_identifier) (private_property_identifier)] @function.method
|
||||||
value: [(function_expression) (arrow_function)])
|
value: [(function_expression) (arrow_function)])
|
||||||
|
|
||||||
(assignment_expression
|
(assignment_expression
|
||||||
left: (member_expression
|
left: (member_expression
|
||||||
property: (property_identifier) @function.method)
|
property: [(property_identifier) (private_property_identifier)] @function.method)
|
||||||
right: [(function_expression) (arrow_function)])
|
right: [(function_expression) (arrow_function)])
|
||||||
|
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
|
@ -248,4 +249,4 @@
|
||||||
(jsx_closing_element (["</" ">"]) @punctuation.bracket.jsx)
|
(jsx_closing_element (["</" ">"]) @punctuation.bracket.jsx)
|
||||||
(jsx_self_closing_element (["<" "/>"]) @punctuation.bracket.jsx)
|
(jsx_self_closing_element (["<" "/>"]) @punctuation.bracket.jsx)
|
||||||
(jsx_attribute "=" @punctuation.delimiter.jsx)
|
(jsx_attribute "=" @punctuation.delimiter.jsx)
|
||||||
(jsx_text) @text.jsx
|
(jsx_text) @text.jsx
|
|
@ -7,6 +7,7 @@
|
||||||
(property_identifier) @property
|
(property_identifier) @property
|
||||||
(shorthand_property_identifier) @property
|
(shorthand_property_identifier) @property
|
||||||
(shorthand_property_identifier_pattern) @property
|
(shorthand_property_identifier_pattern) @property
|
||||||
|
(private_property_identifier) @property
|
||||||
|
|
||||||
; Function and method calls
|
; Function and method calls
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (member_expression
|
function: (member_expression
|
||||||
property: (property_identifier) @function.method))
|
property: [(property_identifier) (private_property_identifier)] @function.method))
|
||||||
|
|
||||||
; Function and method definitions
|
; Function and method definitions
|
||||||
|
|
||||||
|
@ -24,18 +25,18 @@
|
||||||
(function_declaration
|
(function_declaration
|
||||||
name: (identifier) @function)
|
name: (identifier) @function)
|
||||||
(method_definition
|
(method_definition
|
||||||
name: (property_identifier) @function.method)
|
name: [(property_identifier) (private_property_identifier)] @function.method)
|
||||||
(method_definition
|
(method_definition
|
||||||
name: (property_identifier) @constructor
|
name: (property_identifier) @constructor
|
||||||
(#eq? @constructor "constructor"))
|
(#eq? @constructor "constructor"))
|
||||||
|
|
||||||
(pair
|
(pair
|
||||||
key: (property_identifier) @function.method
|
key: [(property_identifier) (private_property_identifier)] @function.method
|
||||||
value: [(function_expression) (arrow_function)])
|
value: [(function_expression) (arrow_function)])
|
||||||
|
|
||||||
(assignment_expression
|
(assignment_expression
|
||||||
left: (member_expression
|
left: (member_expression
|
||||||
property: (property_identifier) @function.method)
|
property: [(property_identifier) (private_property_identifier)] @function.method)
|
||||||
right: [(function_expression) (arrow_function)])
|
right: [(function_expression) (arrow_function)])
|
||||||
|
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
|
@ -254,4 +255,4 @@
|
||||||
(jsx_closing_element (["</" ">"]) @punctuation.bracket.jsx)
|
(jsx_closing_element (["</" ">"]) @punctuation.bracket.jsx)
|
||||||
(jsx_self_closing_element (["<" "/>"]) @punctuation.bracket.jsx)
|
(jsx_self_closing_element (["<" "/>"]) @punctuation.bracket.jsx)
|
||||||
(jsx_attribute "=" @punctuation.delimiter.jsx)
|
(jsx_attribute "=" @punctuation.delimiter.jsx)
|
||||||
(jsx_text) @text.jsx
|
(jsx_text) @text.jsx
|
|
@ -39,6 +39,7 @@
|
||||||
(property_identifier) @property
|
(property_identifier) @property
|
||||||
(shorthand_property_identifier) @property
|
(shorthand_property_identifier) @property
|
||||||
(shorthand_property_identifier_pattern) @property
|
(shorthand_property_identifier_pattern) @property
|
||||||
|
(private_property_identifier) @property
|
||||||
|
|
||||||
; Function and method calls
|
; Function and method calls
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (member_expression
|
function: (member_expression
|
||||||
property: (property_identifier) @function.method))
|
property: [(property_identifier) (private_property_identifier)] @function.method))
|
||||||
|
|
||||||
; Function and method definitions
|
; Function and method definitions
|
||||||
|
|
||||||
|
@ -56,18 +57,18 @@
|
||||||
(function_declaration
|
(function_declaration
|
||||||
name: (identifier) @function)
|
name: (identifier) @function)
|
||||||
(method_definition
|
(method_definition
|
||||||
name: (property_identifier) @function.method)
|
name: [(property_identifier) (private_property_identifier)] @function.method)
|
||||||
(method_definition
|
(method_definition
|
||||||
name: (property_identifier) @constructor
|
name: (property_identifier) @constructor
|
||||||
(#eq? @constructor "constructor"))
|
(#eq? @constructor "constructor"))
|
||||||
|
|
||||||
(pair
|
(pair
|
||||||
key: (property_identifier) @function.method
|
key: [(property_identifier) (private_property_identifier)] @function.method
|
||||||
value: [(function_expression) (arrow_function)])
|
value: [(function_expression) (arrow_function)])
|
||||||
|
|
||||||
(assignment_expression
|
(assignment_expression
|
||||||
left: (member_expression
|
left: (member_expression
|
||||||
property: (property_identifier) @function.method)
|
property: [(property_identifier) (private_property_identifier)] @function.method)
|
||||||
right: [(function_expression) (arrow_function)])
|
right: [(function_expression) (arrow_function)])
|
||||||
|
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
|
@ -270,4 +271,4 @@
|
||||||
"while"
|
"while"
|
||||||
"with"
|
"with"
|
||||||
"yield"
|
"yield"
|
||||||
] @keyword
|
] @keyword
|
Loading…
Add table
Add a link
Reference in a new issue