mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Also fix the case where we are to the right of a spread expr
This commit is contained in:
parent
f224b5022e
commit
a45e9a91bf
@ -3393,6 +3393,7 @@ namespace ts {
|
||||
case SyntaxKind.SlashToken:
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.JsxAttribute:
|
||||
case SyntaxKind.JsxSpreadAttribute:
|
||||
if (parent && (parent.kind === SyntaxKind.JsxSelfClosingElement || parent.kind === SyntaxKind.JsxOpeningElement)) {
|
||||
return <JsxOpeningLikeElement>parent;
|
||||
}
|
||||
@ -3402,7 +3403,7 @@ namespace ts {
|
||||
// its parent is a JsxExpression, whose parent is a JsxAttribute,
|
||||
// whose parent is a JsxOpeningLikeElement
|
||||
case SyntaxKind.StringLiteral:
|
||||
if (parent && parent.kind === SyntaxKind.JsxAttribute) {
|
||||
if (parent && ((parent.kind === SyntaxKind.JsxAttribute) || (parent.kind === SyntaxKind.JsxSpreadAttribute))) {
|
||||
return <JsxOpeningLikeElement>parent.parent;
|
||||
}
|
||||
|
||||
@ -3412,11 +3413,15 @@ namespace ts {
|
||||
if (parent &&
|
||||
parent.kind === SyntaxKind.JsxExpression &&
|
||||
parent.parent &&
|
||||
parent.parent.kind === SyntaxKind.JsxAttribute) {
|
||||
(parent.parent.kind === SyntaxKind.JsxAttribute)) {
|
||||
|
||||
return <JsxOpeningLikeElement>parent.parent.parent;
|
||||
}
|
||||
|
||||
if (parent && parent.kind === SyntaxKind.JsxSpreadAttribute) {
|
||||
return <JsxOpeningLikeElement>parent.parent;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
17
tests/cases/fourslash/tsxCompletion7.ts
Normal file
17
tests/cases/fourslash/tsxCompletion7.ts
Normal file
@ -0,0 +1,17 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//@Filename: file.tsx
|
||||
//// declare module JSX {
|
||||
//// interface Element { }
|
||||
//// interface IntrinsicElements {
|
||||
//// div: { ONE: string; TWO: number; }
|
||||
//// }
|
||||
//// }
|
||||
//// let y = { ONE: '' };
|
||||
//// var x = <div {...y} /**/ />;
|
||||
|
||||
goTo.marker();
|
||||
|
||||
verify.completionListContains("ONE");
|
||||
verify.completionListContains("TWO");
|
||||
verify.not.completionListAllowsNewIdentifier();
|
||||
Loading…
x
Reference in New Issue
Block a user