File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -1688,7 +1688,16 @@ namespace ts.Completions {
16881688
16891689 if ( contextToken . kind === SyntaxKind . GreaterThanToken && contextToken . parent ) {
16901690 if ( contextToken . parent . kind === SyntaxKind . JsxOpeningElement ) {
1691- return true ;
1691+ // Two possibilities:
1692+ // 1. <div>/**/
1693+ // - contextToken: GreaterThanToken (before cursor)
1694+ // - location: JSXElement
1695+ // - different parents (JSXOpeningElement, JSXElement)
1696+ // 2. <Component<string> /**/>
1697+ // - contextToken: GreaterThanToken (before cursor)
1698+ // - location: GreaterThanToken (after cursor)
1699+ // - same parent (JSXOpeningElement)
1700+ return location . parent !== contextToken . parent ;
16921701 }
16931702
16941703 if ( contextToken . parent . kind === SyntaxKind . JsxClosingElement || contextToken . parent . kind === SyntaxKind . JsxSelfClosingElement ) {
Original file line number Diff line number Diff line change 1+ /// <reference path="fourslash.ts" />
2+
3+ // @Filename : /a.tsx
4+ ////declare const React: any;
5+ ////declare function CustomComponent<T>(props: { name: string }): JSX.Element;
6+ ////const element1 = <CustomComponent<string> /*1*/></CustomComponent>;
7+ ////const element2 = <CustomComponent<string> /*2*/ />;
8+
9+ [ '1' , '2' ] . forEach ( marker =>
10+ verify . completions ( {
11+ marker,
12+ exact : [ {
13+ name : 'name' ,
14+ kind : 'JSX attribute' ,
15+ kindModifiers : 'declare'
16+ } ]
17+ } )
18+ ) ;
You can’t perform that action at this time.
0 commit comments