File tree 5 files changed +97
-1
lines changed
5 files changed +97
-1
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ namespace ts.formatting {
126
126
}
127
127
128
128
function shouldRescanJsxText ( node : Node ) : boolean {
129
- return isJsxText ( node ) ;
129
+ return isJsxText ( node ) || isJsxElement ( node ) && lastTokenInfo ?. token . kind === SyntaxKind . JsxText ;
130
130
}
131
131
132
132
function shouldRescanSlashToken ( container : Node ) : boolean {
Original file line number Diff line number Diff line change
1
+ /// <reference path="fourslash.ts" />
2
+
3
+ // @jsx : preserve
4
+ // @filename : a.tsx
5
+ ////function Foo() {
6
+ //// const foo = [
7
+ //// /*a*/<div>' <span></span></div>/*b*/
8
+ //// ];
9
+ //// }
10
+
11
+ goTo . file ( "a.tsx" ) ;
12
+ goTo . select ( "a" , "b" ) ;
13
+ edit . applyRefactor ( {
14
+ refactorName : "Extract Symbol" ,
15
+ actionName : "constant_scope_1" ,
16
+ actionDescription : "Extract to constant in global scope" ,
17
+ newContent :
18
+ `const newLocal = <div>' <span></span></div>;
19
+ function Foo() {
20
+ const foo = [
21
+ /*RENAME*/newLocal
22
+ ];
23
+ }`
24
+ } ) ;
Original file line number Diff line number Diff line change
1
+ /// <reference path="fourslash.ts" />
2
+
3
+ // @jsx : preserve
4
+ // @filename : a.tsx
5
+ ////function Foo() {
6
+ //// const foo = [
7
+ //// /*a*/<div>'" <span></span></div>/*b*/
8
+ //// ];
9
+ //// }
10
+
11
+ goTo . file ( "a.tsx" ) ;
12
+ goTo . select ( "a" , "b" ) ;
13
+ edit . applyRefactor ( {
14
+ refactorName : "Extract Symbol" ,
15
+ actionName : "constant_scope_1" ,
16
+ actionDescription : "Extract to constant in global scope" ,
17
+ newContent :
18
+ `const newLocal = <div>'" <span></span></div>;
19
+ function Foo() {
20
+ const foo = [
21
+ /*RENAME*/newLocal
22
+ ];
23
+ }`
24
+ } ) ;
Original file line number Diff line number Diff line change
1
+ /// <reference path="fourslash.ts" />
2
+
3
+ // @jsx : preserve
4
+ // @filename : a.tsx
5
+ ////function Foo() {
6
+ //// const foo = [
7
+ //// /*a*/<div>text' <span>text' </span>text ' text " </div>/*b*/
8
+ //// ];
9
+ //// }
10
+
11
+ goTo . file ( "a.tsx" ) ;
12
+ goTo . select ( "a" , "b" ) ;
13
+ edit . applyRefactor ( {
14
+ refactorName : "Extract Symbol" ,
15
+ actionName : "constant_scope_1" ,
16
+ actionDescription : "Extract to constant in global scope" ,
17
+ newContent :
18
+ `const newLocal = <div>text' <span>text' </span>text ' text " </div>;
19
+ function Foo() {
20
+ const foo = [
21
+ /*RENAME*/newLocal
22
+ ];
23
+ }`
24
+ } ) ;
Original file line number Diff line number Diff line change
1
+ /// <reference path="fourslash.ts" />
2
+
3
+ // @jsx : preserve
4
+ // @filename : a.tsx
5
+ ////function Foo() {
6
+ //// const foo = [
7
+ //// /*a*/<div>' {1}</div>/*b*/
8
+ //// ];
9
+ //// }
10
+
11
+ goTo . file ( "a.tsx" ) ;
12
+ goTo . select ( "a" , "b" ) ;
13
+ edit . applyRefactor ( {
14
+ refactorName : "Extract Symbol" ,
15
+ actionName : "constant_scope_1" ,
16
+ actionDescription : "Extract to constant in global scope" ,
17
+ newContent :
18
+ `const newLocal = <div>' {1}</div>;
19
+ function Foo() {
20
+ const foo = [
21
+ /*RENAME*/newLocal
22
+ ];
23
+ }`
24
+ } ) ;
You can’t perform that action at this time.
0 commit comments