Basic JSX attribute snippet fixes (#51855)

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
This commit is contained in:
Vitaly
2023-01-09 09:13:27 -08:00
committed by GitHub
co-authored by Andrew Branch
parent fdb5dc56b0
commit 4b69e1342e
2 changed files with 26 additions and 5 deletions
+4 -3
View File
@@ -2875,8 +2875,10 @@ function getCompletionData(
case SyntaxKind.JsxExpression:
case SyntaxKind.JsxSpreadAttribute:
// For `<div foo={true} [||] ></div>`, `parent` will be `{true}` and `previousToken` will be `}`
if (previousToken.kind === SyntaxKind.CloseBraceToken && currentToken.kind === SyntaxKind.GreaterThanToken) {
// First case is for `<div foo={true} [||] />` or `<div foo={true} [||] ></div>`,
// `parent` will be `{true}` and `previousToken` will be `}`
// Second case is for `<div foo={true} t[||] ></div>`
if (previousToken.kind === SyntaxKind.CloseBraceToken || (previousToken.kind === SyntaxKind.Identifier || previousToken.parent.kind === SyntaxKind.JsxAttribute)) {
isJsxIdentifierExpected = true;
}
break;
@@ -5215,4 +5217,3 @@ function toUpperCharCode(charCode: number) {
}
return charCode;
}