File tree 2 files changed +28
-1
lines changed 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -1688,7 +1688,16 @@ namespace ts.Completions {
1688
1688
1689
1689
if ( contextToken . kind === SyntaxKind . GreaterThanToken && contextToken . parent ) {
1690
1690
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 . kind !== SyntaxKind . JsxOpeningElement ;
1692
1701
}
1693
1702
1694
1703
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