Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Type parameters on JSX open tag identifiers cause the JSX block to be highlighted incorrectly #34

Closed
@chrisdrackett

Description

@chrisdrackett

Edit by @rsese to add code from #34 (comment) and link to Apollo example code

export const TaskListItem = ({ id, children }: taskListItemProps) => (
  <Query<taskListItem, taskListItemVariables>
    query={TASK_LIST_ITEM}
    variables={{ id }}
  >
    {(queryProps) => {
      const { loading, data } = queryProps

      if (!loading && data && data.task) {
        return (
          <Mutations task={data.task}>
            {(mutations) => {
              return children({ ...queryProps, mutations })
            }}
          </Mutations>
        )
      } else {
        return children({ ...queryProps, mutations: undefined })
      }
    }}
  </Query>
)

Apollo code example: https://github.com/apollographql/react-apollo/blob/master/examples/typescript/src/Character.tsx


Prerequisites

Description

when adding aliases (?) to a component the rest of the JSX does not render correctly

for example, in the following code

  <Query<taskListItem, taskListItemVariables>
    query={TASK_LIST_ITEM}
    variables={{ id }}
  >
    {(queryProps) => (
      <Mutations id={id}>
        {(mutations) => {
          const finalProps = { ...queryProps, mutations }
          return children(finalProps)
        }}
      </Mutations>
    )}
  </Query>

the <taskListItem, taskListItemVariables> causes the entire jsx block to be rendered incorrectly.

inspecting it looks like the scope goes from:

source.tsx
meta.var.expr.tsx
meta.tag.tsx
entity.name.tag.tsx
support.class.component.tsx

to

source.tsx
meta.var.expr.tsx
variable.other.readwrite.tsx

Versions

Atom: 1.34.0
language-typescript: 0.4.11

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions