Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Add `constructor` highlighting for JS/TS/TSX (#25207)

Devzethe00d737196f7
diff --git a/crates/languages/src/javascript/highlights.scm b/crates/languages/src/javascript/highlights.scm
index 9986390b4e4..f46db408e7d 100644
--- a/crates/languages/src/javascript/highlights.scm
+++ b/crates/languages/src/javascript/highlights.scm
@@ -25,6 +25,9 @@
name: (identifier) @function)
(method_definition
name: (property_identifier) @function.method)
+(method_definition
+ name: (property_identifier) @constructor
+ (#eq? @constructor "constructor"))
(pair
key: (property_identifier) @function.method
diff --git a/crates/languages/src/tsx/highlights.scm b/crates/languages/src/tsx/highlights.scm
index d21f0c2147b..5b83ec903c8 100644
--- a/crates/languages/src/tsx/highlights.scm
+++ b/crates/languages/src/tsx/highlights.scm
@@ -25,6 +25,9 @@
name: (identifier) @function)
(method_definition
name: (property_identifier) @function.method)
+(method_definition
+ name: (property_identifier) @constructor
+ (#eq? @constructor "constructor"))
(pair
key: (property_identifier) @function.method
@@ -45,9 +48,6 @@
; Special identifiers
-((identifier) @constructor
- (#match? @constructor "^[A-Z]"))
-
((identifier) @type
(#match? @type "^[A-Z]"))
(type_identifier) @type
diff --git a/crates/languages/src/typescript/highlights.scm b/crates/languages/src/typescript/highlights.scm
index bccb22fa9c7..502957c93bc 100644
--- a/crates/languages/src/typescript/highlights.scm
+++ b/crates/languages/src/typescript/highlights.scm
@@ -57,6 +57,9 @@
name: (identifier) @function)
(method_definition
name: (property_identifier) @function.method)
+(method_definition
+ name: (property_identifier) @constructor
+ (#eq? @constructor "constructor"))
(pair
key: (property_identifier) @function.method