@@ -174,6 +174,43 @@ namespace ts.projectSystem {
174174 } ) ;
175175 } ) ;
176176
177+ it ( "export default anonymous function works with prefixText and suffixText when disabled" , ( ) => {
178+ const aTs : File = { path : "/a.ts" , content : "export default function() {}" } ;
179+ const bTs : File = { path : "/b.ts" , content : `import aTest from "./a"; function test() { return aTest(); }` } ;
180+
181+ const session = createSession ( createServerHost ( [ aTs , bTs ] ) ) ;
182+ openFilesForSession ( [ bTs ] , session ) ;
183+
184+ session . getProjectService ( ) . setHostConfiguration ( { preferences : { providePrefixAndSuffixTextForRename : false } } ) ;
185+ const response1 = executeSessionRequest < protocol . RenameRequest , protocol . RenameResponse > ( session , protocol . CommandTypes . Rename , protocolFileLocationFromSubstring ( bTs , "aTest(" ) ) ;
186+ assert . deepEqual < protocol . RenameResponseBody | undefined > ( response1 , {
187+ info : {
188+ canRename : true ,
189+ fileToRename : undefined ,
190+ displayName : "aTest" ,
191+ fullDisplayName : "aTest" ,
192+ kind : ScriptElementKind . alias ,
193+ kindModifiers : "export" ,
194+ triggerSpan : protocolTextSpanFromSubstring ( bTs . content , "aTest" , { index : 1 } )
195+ } ,
196+ locs : [ {
197+ file : bTs . path ,
198+ locs : [
199+ protocolRenameSpanFromSubstring ( {
200+ fileText : bTs . content ,
201+ text : "aTest" ,
202+ contextText : `import aTest from "./a";`
203+ } ) ,
204+ protocolRenameSpanFromSubstring ( {
205+ fileText : bTs . content ,
206+ text : "aTest" ,
207+ options : { index : 1 } ,
208+ } )
209+ ]
210+ } ] ,
211+ } ) ;
212+ } ) ;
213+
177214 it ( "rename behavior is based on file of rename initiation" , ( ) => {
178215 const aTs : File = { path : "/a.ts" , content : "const x = 1; export { x };" } ;
179216 const bTs : File = { path : "/b.ts" , content : `import { x } from "./a"; const y = x + 1;` } ;
0 commit comments