diff --git a/src/services/services.ts b/src/services/services.ts index 2bbf286a1f2..48ecce3afc3 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3549,6 +3549,9 @@ namespace ts { if (parent && (parent.kind === SyntaxKind.JsxSelfClosingElement || parent.kind === SyntaxKind.JsxOpeningElement)) { return parent; } + else if (parent.kind === SyntaxKind.JsxAttribute) { + return parent.parent; + } break; // The context token is the closing } or " of an attribute, which means diff --git a/tests/cases/fourslash/tsxCompletion8.ts b/tests/cases/fourslash/tsxCompletion8.ts new file mode 100644 index 00000000000..59ad8385b9d --- /dev/null +++ b/tests/cases/fourslash/tsxCompletion8.ts @@ -0,0 +1,19 @@ +/// + +//@Filename: file.tsx +//// declare module JSX { +//// interface Element { } +//// interface IntrinsicElements { +//// div: { ONE: string; TWO: number; } +//// } +//// } +//// var x =
; + + +goTo.marker('1'); +verify.completionListContains("ONE"); +verify.not.completionListAllowsNewIdentifier(); + +goTo.marker('2'); +verify.completionListContains("ONE"); +verify.not.completionListAllowsNewIdentifier();