Revert "Improve TS/TSX/JS syntax highlighting for parameters, types, and punctuation" (#44490)
Reverts zed-industries/zed#43437 Internally we noticed some regression related to removed query for PascalCase identifiers. Reverting now to prevent this from going to preview, still planning to land this with the necessary fixes later.
This commit is contained in:
@@ -47,45 +47,10 @@
|
|||||||
left: (identifier) @function
|
left: (identifier) @function
|
||||||
right: [(function_expression) (arrow_function)])
|
right: [(function_expression) (arrow_function)])
|
||||||
|
|
||||||
; Parameters
|
|
||||||
|
|
||||||
(required_parameter
|
|
||||||
(identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(required_parameter
|
|
||||||
(_
|
|
||||||
([
|
|
||||||
(identifier)
|
|
||||||
(shorthand_property_identifier_pattern)
|
|
||||||
]) @variable.parameter))
|
|
||||||
|
|
||||||
(optional_parameter
|
|
||||||
(identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(optional_parameter
|
|
||||||
(_
|
|
||||||
([
|
|
||||||
(identifier)
|
|
||||||
(shorthand_property_identifier_pattern)
|
|
||||||
]) @variable.parameter))
|
|
||||||
|
|
||||||
(catch_clause
|
|
||||||
parameter: (identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(index_signature
|
|
||||||
name: (identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(arrow_function
|
|
||||||
parameter: (identifier) @variable.parameter)
|
|
||||||
|
|
||||||
; Special identifiers
|
; Special identifiers
|
||||||
;
|
|
||||||
(class_declaration
|
|
||||||
(type_identifier) @type.class)
|
|
||||||
|
|
||||||
(extends_clause
|
|
||||||
value: (identifier) @type.class)
|
|
||||||
|
|
||||||
|
((identifier) @type
|
||||||
|
(#match? @type "^[A-Z]"))
|
||||||
(type_identifier) @type
|
(type_identifier) @type
|
||||||
(predefined_type) @type.builtin
|
(predefined_type) @type.builtin
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
(tag_name) @keyword.jsdoc
|
(tag_name) @keyword.jsdoc
|
||||||
(type) @type.jsdoc
|
(type) @type.jsdoc
|
||||||
(identifier) @variable.jsdoc
|
|
||||||
|
|||||||
@@ -47,68 +47,13 @@
|
|||||||
left: (identifier) @function
|
left: (identifier) @function
|
||||||
right: [(function_expression) (arrow_function)])
|
right: [(function_expression) (arrow_function)])
|
||||||
|
|
||||||
; Parameters
|
|
||||||
|
|
||||||
(required_parameter
|
|
||||||
(identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(required_parameter
|
|
||||||
(_
|
|
||||||
([
|
|
||||||
(identifier)
|
|
||||||
(shorthand_property_identifier_pattern)
|
|
||||||
]) @variable.parameter))
|
|
||||||
|
|
||||||
(optional_parameter
|
|
||||||
(identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(optional_parameter
|
|
||||||
(_
|
|
||||||
([
|
|
||||||
(identifier)
|
|
||||||
(shorthand_property_identifier_pattern)
|
|
||||||
]) @variable.parameter))
|
|
||||||
|
|
||||||
(catch_clause
|
|
||||||
parameter: (identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(index_signature
|
|
||||||
name: (identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(arrow_function
|
|
||||||
parameter: (identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(type_predicate
|
|
||||||
name: (identifier) @variable.parameter)
|
|
||||||
|
|
||||||
; Special identifiers
|
; Special identifiers
|
||||||
|
|
||||||
(type_annotation) @type
|
((identifier) @type
|
||||||
|
(#match? @type "^[A-Z]"))
|
||||||
(type_identifier) @type
|
(type_identifier) @type
|
||||||
(predefined_type) @type.builtin
|
(predefined_type) @type.builtin
|
||||||
|
|
||||||
(type_alias_declaration
|
|
||||||
(type_identifier) @type)
|
|
||||||
|
|
||||||
(type_alias_declaration
|
|
||||||
value: (_
|
|
||||||
(type_identifier) @type))
|
|
||||||
|
|
||||||
(interface_declaration
|
|
||||||
(type_identifier) @type)
|
|
||||||
|
|
||||||
(class_declaration
|
|
||||||
(type_identifier) @type.class)
|
|
||||||
|
|
||||||
(extends_clause
|
|
||||||
value: (identifier) @type.class)
|
|
||||||
|
|
||||||
(extends_type_clause
|
|
||||||
type: (type_identifier) @type)
|
|
||||||
|
|
||||||
(implements_clause
|
|
||||||
(type_identifier) @type)
|
|
||||||
|
|
||||||
([
|
([
|
||||||
(identifier)
|
(identifier)
|
||||||
(shorthand_property_identifier)
|
(shorthand_property_identifier)
|
||||||
@@ -286,42 +231,8 @@
|
|||||||
"<" @punctuation.bracket
|
"<" @punctuation.bracket
|
||||||
">" @punctuation.bracket)
|
">" @punctuation.bracket)
|
||||||
|
|
||||||
(type_parameters
|
|
||||||
"<" @punctuation.bracket
|
|
||||||
">" @punctuation.bracket)
|
|
||||||
|
|
||||||
(decorator "@" @punctuation.special)
|
(decorator "@" @punctuation.special)
|
||||||
|
|
||||||
(union_type
|
|
||||||
("|") @punctuation.special)
|
|
||||||
|
|
||||||
(intersection_type
|
|
||||||
("&") @punctuation.special)
|
|
||||||
|
|
||||||
(type_annotation
|
|
||||||
(":") @punctuation.special)
|
|
||||||
|
|
||||||
(index_signature
|
|
||||||
(":") @punctuation.special)
|
|
||||||
|
|
||||||
(type_predicate_annotation
|
|
||||||
(":") @punctuation.special)
|
|
||||||
|
|
||||||
(public_field_definition
|
|
||||||
("?") @punctuation.special)
|
|
||||||
|
|
||||||
(property_signature
|
|
||||||
("?") @punctuation.special)
|
|
||||||
|
|
||||||
(method_signature
|
|
||||||
("?") @punctuation.special)
|
|
||||||
|
|
||||||
(optional_parameter
|
|
||||||
([
|
|
||||||
"?"
|
|
||||||
":"
|
|
||||||
]) @punctuation.special)
|
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
|
||||||
[ "abstract"
|
[ "abstract"
|
||||||
|
|||||||
@@ -4,33 +4,11 @@
|
|||||||
|
|
||||||
; Special identifiers
|
; Special identifiers
|
||||||
|
|
||||||
(type_annotation) @type
|
((identifier) @type
|
||||||
|
(#match? @type "^[A-Z]"))
|
||||||
(type_identifier) @type
|
(type_identifier) @type
|
||||||
(predefined_type) @type.builtin
|
(predefined_type) @type.builtin
|
||||||
|
|
||||||
(type_alias_declaration
|
|
||||||
(type_identifier) @type)
|
|
||||||
|
|
||||||
(type_alias_declaration
|
|
||||||
value: (_
|
|
||||||
(type_identifier) @type))
|
|
||||||
|
|
||||||
(interface_declaration
|
|
||||||
(type_identifier) @type)
|
|
||||||
|
|
||||||
(class_declaration
|
|
||||||
(type_identifier) @type.class)
|
|
||||||
|
|
||||||
(extends_clause
|
|
||||||
value: (identifier) @type.class)
|
|
||||||
|
|
||||||
(extends_type_clause
|
|
||||||
type: (type_identifier) @type)
|
|
||||||
|
|
||||||
(implements_clause
|
|
||||||
(type_identifier) @type)
|
|
||||||
|
|
||||||
;; Enables ts-pretty-errors
|
;; Enables ts-pretty-errors
|
||||||
;; The Lsp returns "snippets" of typescript, which are not valid typescript in totality,
|
;; The Lsp returns "snippets" of typescript, which are not valid typescript in totality,
|
||||||
;; but should still be highlighted
|
;; but should still be highlighted
|
||||||
@@ -136,40 +114,6 @@
|
|||||||
|
|
||||||
(arrow_function) @function
|
(arrow_function) @function
|
||||||
|
|
||||||
; Parameters
|
|
||||||
|
|
||||||
(required_parameter
|
|
||||||
(identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(required_parameter
|
|
||||||
(_
|
|
||||||
([
|
|
||||||
(identifier)
|
|
||||||
(shorthand_property_identifier_pattern)
|
|
||||||
]) @variable.parameter))
|
|
||||||
|
|
||||||
(optional_parameter
|
|
||||||
(identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(optional_parameter
|
|
||||||
(_
|
|
||||||
([
|
|
||||||
(identifier)
|
|
||||||
(shorthand_property_identifier_pattern)
|
|
||||||
]) @variable.parameter))
|
|
||||||
|
|
||||||
(catch_clause
|
|
||||||
parameter: (identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(index_signature
|
|
||||||
name: (identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(arrow_function
|
|
||||||
parameter: (identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(type_predicate
|
|
||||||
name: (identifier) @variable.parameter)
|
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
(this) @variable.special
|
(this) @variable.special
|
||||||
@@ -300,42 +244,8 @@
|
|||||||
"<" @punctuation.bracket
|
"<" @punctuation.bracket
|
||||||
">" @punctuation.bracket)
|
">" @punctuation.bracket)
|
||||||
|
|
||||||
(type_parameters
|
|
||||||
"<" @punctuation.bracket
|
|
||||||
">" @punctuation.bracket)
|
|
||||||
|
|
||||||
(decorator "@" @punctuation.special)
|
(decorator "@" @punctuation.special)
|
||||||
|
|
||||||
(union_type
|
|
||||||
("|") @punctuation.special)
|
|
||||||
|
|
||||||
(intersection_type
|
|
||||||
("&") @punctuation.special)
|
|
||||||
|
|
||||||
(type_annotation
|
|
||||||
(":") @punctuation.special)
|
|
||||||
|
|
||||||
(index_signature
|
|
||||||
(":") @punctuation.special)
|
|
||||||
|
|
||||||
(type_predicate_annotation
|
|
||||||
(":") @punctuation.special)
|
|
||||||
|
|
||||||
(public_field_definition
|
|
||||||
("?") @punctuation.special)
|
|
||||||
|
|
||||||
(property_signature
|
|
||||||
("?") @punctuation.special)
|
|
||||||
|
|
||||||
(method_signature
|
|
||||||
("?") @punctuation.special)
|
|
||||||
|
|
||||||
(optional_parameter
|
|
||||||
([
|
|
||||||
"?"
|
|
||||||
":"
|
|
||||||
]) @punctuation.special)
|
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user