mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Basic JSX attribute snippet fixes (#51855)
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user