From 130e16d73b5c64c657418e1cd6b87739364b2b95 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 10 Jun 2021 10:01:25 -0700 Subject: [PATCH] Add missing JSXSpreadAttribute case to JSX completion logic (#44514) --- src/services/completions.ts | 1 + .../cases/fourslash/jsxAriaLikeCompletions.ts | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 tests/cases/fourslash/jsxAriaLikeCompletions.ts diff --git a/src/services/completions.ts b/src/services/completions.ts index fb1fb0fcfad..2de8fafc05c 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1245,6 +1245,7 @@ namespace ts.Completions { break; case SyntaxKind.JsxExpression: + case SyntaxKind.JsxSpreadAttribute: // For `
`, `parent` will be `{true}` and `previousToken` will be `}` if (previousToken.kind === SyntaxKind.CloseBraceToken && currentToken.kind === SyntaxKind.GreaterThanToken) { isJsxIdentifierExpected = true; diff --git a/tests/cases/fourslash/jsxAriaLikeCompletions.ts b/tests/cases/fourslash/jsxAriaLikeCompletions.ts new file mode 100644 index 00000000000..8e325cc5951 --- /dev/null +++ b/tests/cases/fourslash/jsxAriaLikeCompletions.ts @@ -0,0 +1,21 @@ +/// +//@Filename: file.tsx +////declare var React: any; +////declare module JSX { +//// interface Element { } +//// interface IntrinsicElements { +//// div: { "aria-whatever"?: string } +//// } +//// interface ElementAttributesProperty { props: any } +////} +////const a =
; + + +verify.completions( + { + marker: "1", + exact: [ + {name: "aria-whatever", sortText: completion.SortText.OptionalMember} + ] + } +);