Fixed ECMAScript private member highlighting (#10554)

This commit is contained in:
Elizabeth 2024-04-27 20:55:12 +01:00 committed by GitHub
parent 615d34a237
commit bc03b6b5fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -179,6 +179,7 @@ #### Syntax highlighting
- `parameter` - Function parameters
- `other`
- `member` - Fields of composite data types (e.g. structs, unions)
- `private` - Private fields that use a unique syntax (currently just ECMAScript-based languages)
- `label`
@ -206,6 +207,7 @@ #### Syntax highlighting
- `function`
- `builtin`
- `method`
- `private` - Private methods that use a unique syntax (currently just ECMAScript-based languages)
- `macro`
- `special` (preprocessor in C)

View File

@ -29,15 +29,24 @@
name: (identifier) @function)
(method_definition
name: (property_identifier) @function.method)
(method_definition
name: (private_property_identifier) @function.method.private)
(pair
key: (property_identifier) @function.method
value: [(function) (arrow_function)])
(pair
key: (private_property_identifier) @function.method.private
value: [(function) (arrow_function)])
(assignment_expression
left: (member_expression
property: (property_identifier) @function.method)
right: [(function) (arrow_function)])
(assignment_expression
left: (member_expression
property: (private_property_identifier) @function.method.private)
right: [(function) (arrow_function)])
(variable_declarator
name: (identifier) @function
@ -64,6 +73,9 @@
(call_expression
function: (member_expression
property: (property_identifier) @function.method))
(call_expression
function: (member_expression
property: (private_property_identifier) @function.method.private))
; Variables
;----------
@ -74,6 +86,7 @@
;-----------
(property_identifier) @variable.other.member
(private_property_identifier) @variable.other.member.private
(shorthand_property_identifier) @variable.other.member
(shorthand_property_identifier_pattern) @variable.other.member