Skip to content

Commit 130e16d

Browse files
authored
Add missing JSXSpreadAttribute case to JSX completion logic (#44514)
1 parent 481c203 commit 130e16d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/services/completions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,7 @@ namespace ts.Completions {
12451245
break;
12461246

12471247
case SyntaxKind.JsxExpression:
1248+
case SyntaxKind.JsxSpreadAttribute:
12481249
// For `<div foo={true} [||] ></div>`, `parent` will be `{true}` and `previousToken` will be `}`
12491250
if (previousToken.kind === SyntaxKind.CloseBraceToken && currentToken.kind === SyntaxKind.GreaterThanToken) {
12501251
isJsxIdentifierExpected = true;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/// <reference path="fourslash.ts" />
2+
//@Filename: file.tsx
3+
////declare var React: any;
4+
////declare module JSX {
5+
//// interface Element { }
6+
//// interface IntrinsicElements {
7+
//// div: { "aria-whatever"?: string }
8+
//// }
9+
//// interface ElementAttributesProperty { props: any }
10+
////}
11+
////const a = <div {...{}} /*1*/></div>;
12+
13+
14+
verify.completions(
15+
{
16+
marker: "1",
17+
exact: [
18+
{name: "aria-whatever", sortText: completion.SortText.OptionalMember}
19+
]
20+
}
21+
);

0 commit comments

Comments
 (0)