mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Offer correct completion when between a boolean JSX attr and the close tag
Fixes #4574
This commit is contained in:
parent
c55d6dc0e3
commit
b3d2c20ace
@ -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
|
||||
|
||||
19
tests/cases/fourslash/tsxCompletion8.ts
Normal file
19
tests/cases/fourslash/tsxCompletion8.ts
Normal 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();
|
||||
Loading…
x
Reference in New Issue
Block a user