typescript: Add highlighting for Angular inline components (#26553)

Sheik Althaf created

Closes #ISSUE

Release Notes:

- N/A *or* Added/Fixed/Improved ...

Before
<img width="1004" alt="image"
src="https://github.com/user-attachments/assets/9a611e8d-e00e-4dc7-b4c9-bd76fec95525"
/>

After
<img width="936" alt="Image"
src="https://github.com/user-attachments/assets/b83d3309-1aab-492c-a2f1-c45cd19e6bcc"
/>

Change summary

crates/languages/src/typescript/injections.scm | 37 ++++++++++++++++++++
1 file changed, 37 insertions(+)

Detailed changes

crates/languages/src/typescript/injections.scm 🔗

@@ -62,3 +62,40 @@
   arguments: (arguments (template_string (string_fragment) @injection.content
                               (#set! injection.language "graphql")))
 )
+
+;; Angular Component template injection
+(call_expression
+  function: [
+    (identifier) @_decorator (#eq? @_decorator "Component")
+    (member_expression property: (property_identifier) @_decorator (#eq? @_decorator "Component"))
+  ]
+  arguments: (arguments (object
+    (pair
+      key: (property_identifier) @_prop (#eq? @_prop "template")
+      value: [
+        (string) @injection.content
+        (template_string) @injection.content
+        (template_string (string_fragment) @injection.content)
+      ]
+    )))
+  (#set! injection.language "angular"))
+
+;; Angular Component styles injection
+(call_expression
+  function: [
+    (identifier) @_decorator (#eq? @_decorator "Component")
+    (member_expression property: (property_identifier) @_decorator (#eq? @_decorator "Component"))
+  ]
+  arguments: (arguments (object
+    (pair
+      key: (property_identifier) @_prop (#eq? @_prop "styles")
+      value: [
+        (string) @injection.content
+        (template_string) @injection.content
+        (template_string (string_fragment) @injection.content)
+        (array (string) @injection.content)
+        (array (template_string) @injection.content)
+        (array (template_string (string_fragment)) @injection.content)
+      ]
+    )))
+  (#set! injection.language "css"))