@@ -38,7 +38,7 @@ import { INotificationService } from '../../../../../../../platform/notification
3838import { Registry } from '../../../../../../../platform/registry/common/platform.js' ;
3939import { IWorkspaceContextService } from '../../../../../../../platform/workspace/common/workspace.js' ;
4040import { IWorkbenchContributionsRegistry , Extensions as WorkbenchExtensions } from '../../../../../../common/contributions.js' ;
41- import { EditorsOrder } from '../../../../../../common/editor.js' ;
41+ import { EditorsOrder , isDiffEditorInput } from '../../../../../../common/editor.js' ;
4242import { IEditorService } from '../../../../../../services/editor/common/editorService.js' ;
4343import { IHistoryService } from '../../../../../../services/history/common/history.js' ;
4444import { LifecyclePhase } from '../../../../../../services/lifecycle/common/lifecycle.js' ;
@@ -974,21 +974,22 @@ class BuiltinDynamicCompletions extends Disposable {
974974 // HISTORY
975975 // always take the last N items
976976 for ( const [ i , item ] of this . historyService . getHistory ( ) . entries ( ) ) {
977- if ( ! item . resource || seen . has ( item . resource ) || ! this . instantiationService . invokeFunction ( accessor => isSupportedChatFileScheme ( accessor , item . resource ! . scheme ) ) ) {
977+ const resource = isDiffEditorInput ( item ) ? item . modified . resource : item . resource ;
978+ if ( ! resource || seen . has ( resource ) || ! this . instantiationService . invokeFunction ( accessor => isSupportedChatFileScheme ( accessor , resource . scheme ) ) ) {
978979 // ignore editors without a resource
979980 continue ;
980981 }
981982
982983 if ( pattern ) {
983984 // use pattern if available
984- const basename = this . labelService . getUriBasenameLabel ( item . resource ) . toLowerCase ( ) ;
985+ const basename = this . labelService . getUriBasenameLabel ( resource ) . toLowerCase ( ) ;
985986 if ( ! isPatternInWord ( pattern , 0 , pattern . length , basename , 0 , basename . length ) ) {
986987 continue ;
987988 }
988989 }
989990
990- seen . add ( item . resource ) ;
991- const newLen = result . suggestions . push ( makeCompletionItem ( item . resource , FileKind . FILE , i === 0 ? localize ( 'activeFile' , 'Active file' ) : undefined , i === 0 ) ) ;
991+ seen . add ( resource ) ;
992+ const newLen = result . suggestions . push ( makeCompletionItem ( resource , FileKind . FILE , i === 0 ? localize ( 'activeFile' , 'Active file' ) : undefined , i === 0 ) ) ;
992993 if ( newLen - len >= 5 ) {
993994 break ;
994995 }
0 commit comments