@@ -116,4 +116,61 @@ import { value1 } from "../node_modules/.cache/someFile.d.ts";`,
116116 } ) ;
117117 baselineTsserverLogs ( "getMoveToRefactoringFileSuggestions" , "skips lib.d.ts files" , session ) ;
118118 } ) ;
119+
120+ it ( "should show ts files when moving non-tsx content from tsx file" , ( ) => {
121+ const file1 : File = {
122+ path : "/bar.tsx" ,
123+ content : `export function bar() { }` ,
124+ } ;
125+ const file2 : File = {
126+ path : "/foo.ts" ,
127+ content : "export function foo() { }" ,
128+ } ;
129+ const tsconfig : File = {
130+ path : "/tsconfig.json" ,
131+ content : jsonToReadableText ( {
132+ jsx : "preserve" ,
133+ files : [ "./foo.ts" , "./bar.tsx" ] ,
134+ } ) ,
135+ } ;
136+
137+ const host = createServerHost ( [ file1 , file2 , tsconfig ] ) ;
138+ const session = new TestSession ( host ) ;
139+ openFilesForSession ( [ file1 ] , session ) ;
140+
141+ session . executeCommandSeq < ts . server . protocol . GetMoveToRefactoringFileSuggestionsRequest > ( {
142+ command : ts . server . protocol . CommandTypes . GetMoveToRefactoringFileSuggestions ,
143+ arguments : { file : file1 . path , line : 1 , offset : 7 } ,
144+ } ) ;
145+ baselineTsserverLogs ( "getMoveToRefactoringFileSuggestions" , "should show ts files when moving non-tsx content from tsx file" , session ) ;
146+ } ) ;
147+
148+ it ( "should show js files when moving non-jsx content from jsx file" , ( ) => {
149+ const file1 : File = {
150+ path : "/bar.jsx" ,
151+ content : `export function bar() { }` ,
152+ } ;
153+ const file2 : File = {
154+ path : "/foo.js" ,
155+ content : "export function foo() { }" ,
156+ } ;
157+ const tsconfig : File = {
158+ path : "/tsconfig.json" ,
159+ content : jsonToReadableText ( {
160+ allowJS : true ,
161+ jsx : "preserve" ,
162+ files : [ "./foo.js" , "./bar.jsx" ] ,
163+ } ) ,
164+ } ;
165+
166+ const host = createServerHost ( [ file1 , file2 , tsconfig ] ) ;
167+ const session = new TestSession ( host ) ;
168+ openFilesForSession ( [ file1 ] , session ) ;
169+
170+ session . executeCommandSeq < ts . server . protocol . GetMoveToRefactoringFileSuggestionsRequest > ( {
171+ command : ts . server . protocol . CommandTypes . GetMoveToRefactoringFileSuggestions ,
172+ arguments : { file : file1 . path , line : 1 , offset : 7 } ,
173+ } ) ;
174+ baselineTsserverLogs ( "getMoveToRefactoringFileSuggestions" , "should show js files when moving non-jsx content from jsx file" , session ) ;
175+ } ) ;
119176} ) ;
0 commit comments