Skip to content

Commit b3d2c20

Browse files
committed
Offer correct completion when between a boolean JSX attr and the close tag
Fixes microsoft#4574
1 parent c55d6dc commit b3d2c20

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/services/services.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3549,6 +3549,9 @@ namespace ts {
35493549
if (parent && (parent.kind === SyntaxKind.JsxSelfClosingElement || parent.kind === SyntaxKind.JsxOpeningElement)) {
35503550
return <JsxOpeningLikeElement>parent;
35513551
}
3552+
else if (parent.kind === SyntaxKind.JsxAttribute) {
3553+
return <JsxOpeningLikeElement>parent.parent;
3554+
}
35523555
break;
35533556

35543557
// The context token is the closing } or " of an attribute, which means
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//@Filename: file.tsx
4+
//// declare module JSX {
5+
//// interface Element { }
6+
//// interface IntrinsicElements {
7+
//// div: { ONE: string; TWO: number; }
8+
//// }
9+
//// }
10+
//// var x = <div /*1*/ autoComplete /*2*/ />;
11+
12+
13+
goTo.marker('1');
14+
verify.completionListContains("ONE");
15+
verify.not.completionListAllowsNewIdentifier();
16+
17+
goTo.marker('2');
18+
verify.completionListContains("ONE");
19+
verify.not.completionListAllowsNewIdentifier();

0 commit comments

Comments
 (0)