Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show editor progress while generating chat edits #229050

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ContextKeyExpr } from '../../../../../platform/contextkey/common/contex
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
import { KeybindingWeight } from '../../../../../platform/keybinding/common/keybindingsRegistry.js';
import { INotificationService } from '../../../../../platform/notification/common/notification.js';
import { IProgressService, ProgressLocation } from '../../../../../platform/progress/common/progress.js';
import { IEditorProgressService } from '../../../../../platform/progress/common/progress.js';
import { TerminalLocation } from '../../../../../platform/terminal/common/terminal.js';
import { IUntitledTextResourceEditorInput } from '../../../../common/editor.js';
import { IEditorService } from '../../../../services/editor/common/editorService.js';
Expand Down Expand Up @@ -238,9 +238,9 @@ export function registerChatCodeBlockActions() {
override async run(accessor: ServicesAccessor, ...args: any[]) {
const chatWidgetService = accessor.get(IChatWidgetService);
const codemapperService = accessor.get(ICodeMapperService);
const progressService = accessor.get(IProgressService);
const chatEditingService = accessor.get(IChatEditingService);
const notificationService = accessor.get(INotificationService);
const editorProgressService = accessor.get(IEditorProgressService);

if (chatEditingService.currentEditingSession) {
// there is already an editing session active, we should not start a new one
Expand Down Expand Up @@ -279,15 +279,9 @@ export function registerChatCodeBlockActions() {

// Invoke the code mapper for all the code blocks in this response
const tokenSource = new CancellationTokenSource();
await progressService.withProgress({
location: ProgressLocation.Notification,
title: localize2('chatCodeBlock.generatingEdits', 'Applying all edits').value,
cancellable: true
}, async (task) => {
task.report({ message: localize2('chatCodeBlock.generating', 'Generating edits...').value });
await codemapperService.mapCode({ codeBlocks: request, conversation: [] }, response, tokenSource.token);
task.report({ message: localize2('chatCodeBlock.applyAllEdits', 'Applying edits to workspace...').value });
}, () => tokenSource.cancel());
const codemapperPromise = codemapperService.mapCode({ codeBlocks: request, conversation: [] }, response, tokenSource.token);
editorProgressService.showWhile(codemapperPromise);
await codemapperPromise;
});
}
});
Expand Down
Loading