resolve comments

This commit is contained in:
Peng Lyu
2026-03-12 20:11:18 -07:00
parent e08c8efd77
commit 595e039a0b
4 changed files with 14 additions and 5 deletions

View File

@@ -27,6 +27,7 @@ import { GroupDirection, GroupsOrder, IModalEditorPart, GroupActivationReason }
import { IEditorService } from '../../../services/editor/common/editorService.js';
import { EditorPartModalContext, EditorPartModalMaximizedContext, EditorPartModalNavigationContext } from '../../../common/contextkeys.js';
import { EditorResourceAccessor, SideBySideEditor, Verbosity } from '../../../common/editor.js';
import { EditorInput } from '../../../common/editor/editorInput.js';
import { ResourceLabel } from '../../labels.js';
import { IHostService } from '../../../services/host/browser/host.js';
import { IWorkbenchLayoutService, Parts } from '../../../services/layout/browser/layoutService.js';
@@ -285,6 +286,7 @@ export class ModalEditorPart {
// Create label
const label = disposables.add(scopedInstantiationService.createInstance(ResourceLabel, titleElement, {}));
const labelChangeDisposable = disposables.add(new MutableDisposable());
let trackedEditor: EditorInput | undefined;
const updateLabel = () => {
const activeEditor = editorPart.activeGroup.activeEditor;
if (activeEditor) {
@@ -302,9 +304,14 @@ export class ModalEditorPart {
}
);
labelChangeDisposable.value = activeEditor.onDidChangeLabel(() => updateLabel());
// Only (re)subscribe when the active editor changes, not on every label update
if (trackedEditor !== activeEditor) {
trackedEditor = activeEditor;
labelChangeDisposable.value = activeEditor.onDidChangeLabel(() => updateLabel());
}
} else {
label.element.clear();
trackedEditor = undefined;
labelChangeDisposable.clear();
}
};

View File

@@ -483,7 +483,9 @@ export class ImageAttachmentWidget extends AbstractChatAttachmentWidget {
const sections: { title: string; images: IChatExtractedImage[] }[] = [];
let clickedGlobalIndex = -1;
let globalOffset = 0;
let collectionId: string | undefined;
// Use session-level ID so the same carousel is reused regardless of which image is clicked
const collectionId = widget.viewModel.sessionResource.toString() + '_carousel';
for (const response of responses) {
const extracted = extractImagesFromChatResponse(response);
@@ -496,7 +498,6 @@ export class ImageAttachmentWidget extends AbstractChatAttachmentWidget {
: extracted.images.findIndex(img => img.data.equals(VSBuffer.wrap(data)));
if (localIndex !== -1) {
clickedGlobalIndex = globalOffset + localIndex;
collectionId = extracted.id;
}
}
@@ -504,7 +505,7 @@ export class ImageAttachmentWidget extends AbstractChatAttachmentWidget {
}
}
if (clickedGlobalIndex !== -1 && collectionId && sections.length > 0) {
if (clickedGlobalIndex !== -1 && sections.length > 0) {
await this.commandService.executeCommand('workbench.action.chat.openImageInCarousel', {
collection: {
id: collectionId,

View File

@@ -209,7 +209,7 @@ export class ImageCarouselEditor extends EditorPane {
}
/**
* Update only the changing parts: main image src, caption, counter, button states, thumbnail selection.
* Update only the changing parts: main image src, caption, button states, thumbnail selection.
* No DOM teardown/rebuild — eliminates the blank flash.
*/
private updateCurrentImage(): void {

View File

@@ -142,6 +142,7 @@
align-items: center;
gap: 6px;
overflow-x: auto;
justify-content: center;
justify-content: safe center;
padding: 0;
flex-shrink: 0;