File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -1038,7 +1038,20 @@ namespace ts.Completions {
1038
1038
}
1039
1039
break ;
1040
1040
1041
+ case SyntaxKind . JsxExpression :
1042
+ // For `<div foo={true} [||] ></div>`, `parent` will be `{true}` and `previousToken` will be ` }`
1043
+ if ( previousToken . kind === SyntaxKind . CloseBraceToken && currentToken . kind === SyntaxKind . GreaterThanToken ) {
1044
+ isJsxIdentifierExpected = true ;
1045
+ }
1046
+ break ;
1047
+
1041
1048
case SyntaxKind . JsxAttribute :
1049
+ // For `<div className="x" [||] ></div>`, `parent` will be JsxAttribute and `previousToken` will be its initializer
1050
+ if ( ( parent as JsxAttribute ) . initializer === previousToken &&
1051
+ previousToken . end < position ) {
1052
+ isJsxIdentifierExpected = true ;
1053
+ break ;
1054
+ }
1042
1055
switch ( previousToken . kind ) {
1043
1056
case SyntaxKind . EqualsToken :
1044
1057
isJsxInitializer = true ;
Original file line number Diff line number Diff line change
1
+ /// <reference path="fourslash.ts" />
2
+
3
+ // @jsx : preserve
4
+
5
+ // @Filename : /a.tsx
6
+ ////declare namespace JSX {
7
+ //// interface Element {}
8
+ //// interface IntrinsicElements {
9
+ //// div: {
10
+ //// /** Doc */
11
+ //// foo: boolean;
12
+ //// bar: string;
13
+ //// "aria-foo": boolean;
14
+ //// }
15
+ //// }
16
+ //// }
17
+ ////
18
+ ////<div foo /*1*/></div>;
19
+ ////<div foo={true} /*2*/></div>;
20
+ ////<div bar="test" /*3*/></div>;
21
+ ////<div aria-foo /*4*/></div>;
22
+
23
+
24
+ verify . completions ( { marker : "1" , exact : [ "bar" , "aria-foo" ] } ) ;
25
+ verify . completions ( { marker : "2" , exact : [ "bar" , "aria-foo" ] } ) ;
26
+ verify . completions ( { marker : "3" , exact : [ "foo" , "aria-foo" ] } ) ;
27
+ verify . completions ( { marker : "4" , exact : [ "foo" , "bar" ] } ) ;
You can’t perform that action at this time.
0 commit comments