@@ -7,7 +7,7 @@ import { CancellationToken } from '../../../../../base/common/cancellation.js';
77import { Codicon } from '../../../../../base/common/codicons.js' ;
88import { KeyCode , KeyMod } from '../../../../../base/common/keyCodes.js' ;
99import { basename } from '../../../../../base/common/resources.js' ;
10- import { URI } from '../../../../../base/common/uri.js' ;
10+ import { URI , UriComponents } from '../../../../../base/common/uri.js' ;
1111import { isCodeEditor } from '../../../../../editor/browser/editorBrowser.js' ;
1212import { ServicesAccessor } from '../../../../../editor/browser/editorExtensions.js' ;
1313import { Position } from '../../../../../editor/common/core/position.js' ;
@@ -18,6 +18,7 @@ import { ILanguageFeaturesService } from '../../../../../editor/common/services/
1818import { ITextModelService } from '../../../../../editor/common/services/resolverService.js' ;
1919import { localize , localize2 } from '../../../../../nls.js' ;
2020import { Action2 , IAction2Options , MenuId , registerAction2 } from '../../../../../platform/actions/common/actions.js' ;
21+ import { CommandsRegistry } from '../../../../../platform/commands/common/commands.js' ;
2122import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js' ;
2223import { ContextKeyExpr } from '../../../../../platform/contextkey/common/contextkey.js' ;
2324import { IDialogService } from '../../../../../platform/dialogs/common/dialogs.js' ;
@@ -745,3 +746,19 @@ export class ViewPreviousEditsAction extends EditingSessionAction {
745746 }
746747}
747748registerAction2 ( ViewPreviousEditsAction ) ;
749+
750+ /**
751+ * Workbench command to explore accepting working set changes from an extension. Executing
752+ * the command will accept the changes for the provided resources across all edit sessions.
753+ */
754+ CommandsRegistry . registerCommand ( '_chat.editSessions.accept' , async ( accessor : ServicesAccessor , resources : UriComponents [ ] ) => {
755+ if ( resources . length === 0 ) {
756+ return ;
757+ }
758+
759+ const uris = resources . map ( resource => URI . revive ( resource ) ) ;
760+ const chatEditingService = accessor . get ( IChatEditingService ) ;
761+ for ( const editingSession of chatEditingService . editingSessionsObs . get ( ) ) {
762+ await editingSession . accept ( ...uris ) ;
763+ }
764+ } ) ;
0 commit comments