[language-typescript] Various highlighting fixes…

* Declared namespaces should be `entity` only, not `support`
* `<` and `>` in type parameters should always have the proper `punctuation` scopes applied
* All TSX tags should have the surrounding `meta.tag.ts.tsx` scope applied
* TSX fragments (`<>`) should be highlighted
This commit is contained in:
Andrew Dupont 2024-01-24 17:09:42 -08:00
parent a0595b275d
commit f1ce722f33
2 changed files with 18 additions and 5 deletions

View File

@ -294,7 +294,8 @@
; ==========
(interface_declaration
name: (_) @entity.name.type.interface._LANG_)
name: (_) @entity.name.type.interface._LANG_
(#set! capture.final))
; TYPES
@ -310,6 +311,11 @@
(type_arguments ">" @punctuation.definition.parameters.end.bracket.angle.js
(#set! capture.final))
(type_parameters "<" @punctuation.definition.parameters.begin.bracket.angle.js
(#set! capture.final))
(type_parameters ">" @punctuation.definition.parameters.end.bracket.angle.js
(#set! capture.final))
"=>" @storage.type.arrow._LANG_
; TODO: If I allow scopes like `storage.type.string._LANG_`, I will make a lot of

View File

@ -9,24 +9,27 @@
; The "Foo" in `<Foo>`.
(jsx_opening_element
name: (identifier) @entity.name.tag.ts.tsx)
name: (identifier) @entity.name.tag.ts.tsx) @meta.tag.ts.tsx
; The "Foo.Bar" in `<Foo.Bar>`.
(jsx_opening_element
name: (nested_identifier) @entity.name.tag.ts.tsx)
name: (nested_identifier) @entity.name.tag.ts.tsx) @meta.tag.ts.tsx
; The "Foo" in `</Foo>`.
(jsx_closing_element
name: (identifier) @entity.name.tag.ts.tsx)
name: (identifier) @entity.name.tag.ts.tsx) @meta.tag.ts.tsx
; The "Foo.Bar" in `</Foo.Bar>`.
(jsx_closing_element
name: (nested_identifier) @entity.name.tag.ts.tsx)
name: (nested_identifier) @entity.name.tag.ts.tsx) @meta.tag.ts.tsx
; The "bar" in `<Foo bar={true} />`.
(jsx_attribute
(property_identifier) @entity.other.attribute-name.ts.tsx)
; The empty tag used as a shorthand for a fragment: `<>`.
(jsx_fragment) @meta.tag.ts.tsx
; The slashes in closing tags should not be interpreted as math operators.
(jsx_self_closing_element "/" @punctuation.definition.tag.end.ts.tsx
(#set! capture.final true))
@ -48,6 +51,10 @@
"<" @punctuation.definition.tag.begin.ts.tsx
">" @punctuation.definition.tag.end.ts.tsx)
(jsx_fragment
"<" @punctuation.definition.tag.begin.ts.tsx
">" @punctuation.definition.tag.end.ts.tsx)
(jsx_self_closing_element
"<" @punctuation.definition.tag.begin.ts.tsx
(#set! capture.final true))