Offer correct completion when between a boolean JSX attr and the close tag

Fixes #4574
This commit is contained in:
Ryan Cavanaugh 2015-09-28 17:13:29 -07:00
parent c55d6dc0e3
commit b3d2c20ace
2 changed files with 22 additions and 0 deletions

View File

@ -3549,6 +3549,9 @@ namespace ts {
if (parent && (parent.kind === SyntaxKind.JsxSelfClosingElement || parent.kind === SyntaxKind.JsxOpeningElement)) {
return <JsxOpeningLikeElement>parent;
}
else if (parent.kind === SyntaxKind.JsxAttribute) {
return <JsxOpeningLikeElement>parent.parent;
}
break;
// The context token is the closing } or " of an attribute, which means

View File

@ -0,0 +1,19 @@
/// <reference path='fourslash.ts' />
//@Filename: file.tsx
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// div: { ONE: string; TWO: number; }
//// }
//// }
//// var x = <div /*1*/ autoComplete /*2*/ />;
goTo.marker('1');
verify.completionListContains("ONE");
verify.not.completionListAllowsNewIdentifier();
goTo.marker('2');
verify.completionListContains("ONE");
verify.not.completionListAllowsNewIdentifier();