@@ -316,21 +316,40 @@ export class SearchEditorInput extends EditorInput {
316
316
}
317
317
} ;
318
318
}
319
+
320
+ override copy ( ) : EditorInput {
321
+ // Generate a new modelUri for the split editor
322
+ const newModelUri = URI . from ( { scheme : SearchEditorScheme , fragment : `${ Math . random ( ) } ` } ) ;
323
+ const config = this . _cachedConfigurationModel ?. config ?? { } ;
324
+ const results = this . _cachedResultsModel ?. getValue ( ) ?? '' ;
325
+ // Use the 'rawData' variant and pass modelUri
326
+ return this . instantiationService . invokeFunction (
327
+ getOrMakeSearchEditorInput ,
328
+ { from : 'rawData' , config, resultsContents : results , modelUri : newModelUri } as any // modelUri is not in the type, but we handle it below
329
+ ) ;
330
+ }
319
331
}
320
332
321
333
export const getOrMakeSearchEditorInput = (
322
334
accessor : ServicesAccessor ,
323
335
existingData : (
324
336
| { from : 'model' ; config ?: Partial < SearchConfiguration > ; modelUri : URI ; backupOf ?: URI }
325
- | { from : 'rawData' ; resultsContents : string | undefined ; config : Partial < SearchConfiguration > }
337
+ | { from : 'rawData' ; resultsContents : string | undefined ; config : Partial < SearchConfiguration > ; modelUri ?: URI }
326
338
| { from : 'existingFile' ; fileUri : URI } )
327
339
) : SearchEditorInput => {
328
340
329
341
const storageService = accessor . get ( IStorageService ) ;
330
342
const configurationService = accessor . get ( IConfigurationService ) ;
331
343
332
344
const instantiationService = accessor . get ( IInstantiationService ) ;
333
- const modelUri = existingData . from === 'model' ? existingData . modelUri : URI . from ( { scheme : SearchEditorScheme , fragment : `${ Math . random ( ) } ` } ) ;
345
+ let modelUri : URI ;
346
+ if ( existingData . from === 'model' ) {
347
+ modelUri = existingData . modelUri ;
348
+ } else if ( existingData . from === 'rawData' && existingData . modelUri ) {
349
+ modelUri = existingData . modelUri ;
350
+ } else {
351
+ modelUri = URI . from ( { scheme : SearchEditorScheme , fragment : `${ Math . random ( ) } ` } ) ;
352
+ }
334
353
335
354
if ( ! searchEditorModelFactory . models . has ( modelUri ) ) {
336
355
if ( existingData . from === 'existingFile' ) {
0 commit comments