Skip to content

JSX text causes random formatting #11636

Description

@RyanCavanaugh

There's not a solid repro for this but there's a bug in our SyntaxKind enum -- the JsxText kind parses as a token (which it should), but it's after LastToken. The formatting engine uses an N * N sparse array computed with N = LastToken. When the formatting computes the formatting context by using a token pair, this means a JsxToken ends up looking up a random formatting context. This causes JSX formatting to break, sometimes, when you add a new token and change the value of LastToken.

/cc @weswigham who was understandably baffled by this 11dce6f

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions