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.

typescript: Fix type import highlighting when alias is not present (#47190)

Delyan Haralanov04d878eef8ca
diff --git a/crates/languages/src/typescript/highlights.scm b/crates/languages/src/typescript/highlights.scm
index e38467626fe..8ec3ec26cca 100644
--- a/crates/languages/src/typescript/highlights.scm
+++ b/crates/languages/src/typescript/highlights.scm
@@ -98,18 +98,34 @@
(statement_block) @nested
])))
+; Inline type imports: import { type Foo } or import { type Foo as Bar }
(import_specifier
"type"
name: (identifier) @type
+)
+
+(import_specifier
+ "type"
alias: (identifier) @type
)
+; Full type imports: import type { Foo } or import type { Foo as Bar }
(import_statement
"type"
(import_clause
(named_imports
(import_specifier
name: (identifier) @type
+ )
+ )
+ )
+)
+
+(import_statement
+ "type"
+ (import_clause
+ (named_imports
+ (import_specifier
alias: (identifier) @type
)
)