mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-10-05 15:07:49 +03:00
[language-(java|type)script] Prevent the FOO
in <FOO.Bar>
…
…from getting a `constant.other` scope applied. Also ensure correct scoping of JSX tags even when the tag name is a member expression like `Foo.Bar`.
This commit is contained in:
parent
5024f052e0
commit
55e869c786
@ -1,3 +1,25 @@
|
||||
; MISC
|
||||
; ====
|
||||
|
||||
; In the JSX construct `<FOO.Bar>`, `FOO` should not be marked as
|
||||
; `constant.other.js`. Block off identifiers within complex JSX tag names early
|
||||
; to prevent this.
|
||||
|
||||
(jsx_opening_element
|
||||
(member_expression
|
||||
(identifier) @_IGNORE_
|
||||
(#set! capture.final)))
|
||||
|
||||
(jsx_closing_element
|
||||
(member_expression
|
||||
(identifier) @_IGNORE_
|
||||
(#set! capture.final)))
|
||||
|
||||
(jsx_self_closing_element
|
||||
(member_expression
|
||||
(identifier) @_IGNORE_
|
||||
(#set! capture.final)))
|
||||
|
||||
|
||||
; STRINGS
|
||||
; =======
|
||||
@ -775,16 +797,16 @@
|
||||
|
||||
; The "Foo" in `<Foo />`.
|
||||
(jsx_self_closing_element
|
||||
name: (identifier) @entity.name.tag.js
|
||||
name: (_) @entity.name.tag.js
|
||||
) @meta.tag.jsx.js
|
||||
|
||||
; The "Foo" in `<Foo>`.
|
||||
(jsx_opening_element
|
||||
name: (identifier) @entity.name.tag.js)
|
||||
name: (_) @entity.name.tag.js)
|
||||
|
||||
; The "Foo" in `</Foo>`.
|
||||
(jsx_closing_element
|
||||
name: (identifier) @entity.name.tag.js)
|
||||
name: (_) @entity.name.tag.js)
|
||||
|
||||
; The "bar" in `<Foo bar={true} />`.
|
||||
(jsx_attribute
|
||||
|
@ -14,8 +14,8 @@ treeSitter:
|
||||
languageSegment: 'ts.tsx'
|
||||
grammar: 'tree-sitter-tsx/tree-sitter-tsx.wasm'
|
||||
highlightsQuery: [
|
||||
'common/highlights.scm'
|
||||
'tree-sitter-tsx/highlights.scm'
|
||||
'common/highlights.scm'
|
||||
]
|
||||
indentsQuery: [
|
||||
'common/indents.scm'
|
||||
|
@ -1,10 +1,31 @@
|
||||
; MISC
|
||||
; ====
|
||||
|
||||
; In the JSX construct `<FOO.Bar>`, `FOO` should not be marked as
|
||||
; `constant.other.ts.tsx`. Block off identifiers within complex JSX tag names
|
||||
; early to prevent this.
|
||||
|
||||
(jsx_opening_element
|
||||
(nested_identifier
|
||||
(identifier) @_IGNORE_
|
||||
(#set! capture.final)))
|
||||
|
||||
(jsx_closing_element
|
||||
(nested_identifier
|
||||
(identifier) @_IGNORE_
|
||||
(#set! capture.final)))
|
||||
|
||||
(jsx_self_closing_element
|
||||
(nested_identifier
|
||||
(identifier) @_IGNORE_
|
||||
(#set! capture.final)))
|
||||
|
||||
; JSX
|
||||
; ===
|
||||
|
||||
; The "Foo" in `<Foo />`.
|
||||
(jsx_self_closing_element
|
||||
name: (identifier) @entity.name.tag.ts.tsx
|
||||
name: (_) @entity.name.tag.ts.tsx
|
||||
) @meta.tag.ts.tsx
|
||||
|
||||
; The "Foo" in `<Foo>`.
|
||||
|
Loading…
Reference in New Issue
Block a user