Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions src/vs/workbench/contrib/chat/browser/chatEditingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class ChatEditingService extends Disposable implements IChatEditingServic
@IChatService private readonly _chatService: IChatService,
@IProgressService private readonly _progressService: IProgressService,
@ICodeMapperService private readonly _codeMapperService: ICodeMapperService,
@IEditorService private readonly _editorService: IEditorService,
) {
super();
this._register(multiDiffSourceResolverService.registerResolver(_instantiationService.createInstance(ChatEditingMultiDiffSourceResolver, this._currentSessionObs)));
Expand Down Expand Up @@ -189,14 +190,24 @@ export class ChatEditingService extends Disposable implements IChatEditingServic
}
};

const openCodeBlockUris = (responseModel: IChatResponseModel) => {
for (const part of responseModel.response.value) {
if (part.kind === 'codeblockUri') {
this._editorService.openEditor({ resource: part.uri, options: { inactive: true, preserveFocus: true, pinned: true } });
}
}
};

observerDisposables.add(chatModel.onDidChange(e => {
if (e.kind === 'addRequest') {
const responseModel = e.request.response;
if (responseModel) {
if (responseModel.isComplete) {
openCodeBlockUris(responseModel);
onResponseComplete(responseModel);
} else {
const disposable = responseModel.onDidChange(() => {
openCodeBlockUris(responseModel);
if (responseModel.isComplete) {
onResponseComplete(responseModel);
disposable.dispose();
Expand Down
4 changes: 4 additions & 0 deletions src/vs/workbench/contrib/chat/browser/chatEditorController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Constants } from '../../../../base/common/uint.js';
import { ICodeEditor, IViewZone } from '../../../../editor/browser/editorBrowser.js';
import { LineSource, renderLines, RenderOptions } from '../../../../editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';
import { diffAddDecoration, diffDeleteDecoration, diffWholeLineAddDecoration } from '../../../../editor/browser/widget/diffEditor/registrations.contribution.js';
import { EditorOption } from '../../../../editor/common/config/editorOptions.js';
import { IDocumentDiff } from '../../../../editor/common/diff/documentDiffProvider.js';
import { IEditorContribution } from '../../../../editor/common/editorCommon.js';
import { IModelDeltaDecoration, ITextModel } from '../../../../editor/common/model.js';
Expand Down Expand Up @@ -38,6 +39,9 @@ export class ChatEditorController extends Disposable implements IEditorContribut
if (!this._editor.hasModel()) {
return;
}
if (this._editor.getOption(EditorOption.inDiffEditor)) {
return;
}
const model = this._editor.getModel();
this._sessionStore.add(model.onDidChangeContent(() => this._updateSessionDecorations()));
this._updateSessionDecorations();
Expand Down