Skip to content

Commit 0eb2ec5

Browse files
authored
Use simple editor widget for tool confirmation editors (microsoft#255578)
Add tool simple editor changes
1 parent 3e2b7a1 commit 0eb2ec5

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownContentPart.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,12 @@ export class EditorPool extends Disposable {
313313
options: ChatEditorOptions,
314314
delegate: IChatRendererDelegate,
315315
overflowWidgetsDomNode: HTMLElement | undefined,
316+
private readonly isSimpleWidget: boolean = false,
316317
@IInstantiationService instantiationService: IInstantiationService,
317318
) {
318319
super();
319320
this._pool = this._register(new ResourcePool(() => {
320-
return instantiationService.createInstance(CodeBlockPart, options, MenuId.ChatCodeBlock, delegate, overflowWidgetsDomNode);
321+
return instantiationService.createInstance(CodeBlockPart, options, MenuId.ChatCodeBlock, delegate, overflowWidgetsDomNode, this.isSimpleWidget);
321322
}));
322323
}
323324

src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,12 @@ export class DiffEditorPool extends Disposable {
147147
options: ChatEditorOptions,
148148
delegate: IChatRendererDelegate,
149149
overflowWidgetsDomNode: HTMLElement | undefined,
150+
private readonly isSimpleWidget: boolean = false,
150151
@IInstantiationService instantiationService: IInstantiationService,
151152
) {
152153
super();
153154
this._pool = this._register(new ResourcePool(() => {
154-
return instantiationService.createInstance(CodeCompareBlockPart, options, MenuId.ChatCompareBlock, delegate, overflowWidgetsDomNode);
155+
return instantiationService.createInstance(CodeCompareBlockPart, options, MenuId.ChatCompareBlock, delegate, overflowWidgetsDomNode, this.isSimpleWidget);
155156
}));
156157
}
157158

src/vs/workbench/contrib/chat/browser/chatListRenderer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
203203

204204
this.renderer = this.instantiationService.createInstance(ChatMarkdownRenderer, undefined);
205205
this.markdownDecorationsRenderer = this.instantiationService.createInstance(ChatMarkdownDecorationsRenderer);
206-
this._editorPool = this._register(this.instantiationService.createInstance(EditorPool, editorOptions, delegate, overflowWidgetsDomNode));
207-
this._toolEditorPool = this._register(this.instantiationService.createInstance(EditorPool, editorOptions, delegate, overflowWidgetsDomNode));
208-
this._diffEditorPool = this._register(this.instantiationService.createInstance(DiffEditorPool, editorOptions, delegate, overflowWidgetsDomNode));
206+
this._editorPool = this._register(this.instantiationService.createInstance(EditorPool, editorOptions, delegate, overflowWidgetsDomNode, false));
207+
this._toolEditorPool = this._register(this.instantiationService.createInstance(EditorPool, editorOptions, delegate, overflowWidgetsDomNode, true));
208+
this._diffEditorPool = this._register(this.instantiationService.createInstance(DiffEditorPool, editorOptions, delegate, overflowWidgetsDomNode, false));
209209
this._treePool = this._register(this.instantiationService.createInstance(TreePool, this._onDidChangeVisibility.event));
210210
this._contentReferencesListPool = this._register(this.instantiationService.createInstance(CollapsibleListPool, this._onDidChangeVisibility.event, undefined, undefined));
211211

src/vs/workbench/contrib/chat/browser/codeBlockPart.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export class CodeBlockPart extends Disposable {
179179
readonly menuId: MenuId,
180180
delegate: IChatRendererDelegate,
181181
overflowWidgetsDomNode: HTMLElement | undefined,
182+
private readonly isSimpleWidget: boolean = false,
182183
@IInstantiationService instantiationService: IInstantiationService,
183184
@IContextKeyService contextKeyService: IContextKeyService,
184185
@IModelService protected readonly modelService: IModelService,
@@ -306,7 +307,7 @@ export class CodeBlockPart extends Disposable {
306307

307308
private createEditor(instantiationService: IInstantiationService, parent: HTMLElement, options: Readonly<IEditorConstructionOptions>): CodeEditorWidget {
308309
return this._register(instantiationService.createInstance(CodeEditorWidget, parent, options, {
309-
isSimpleWidget: false,
310+
isSimpleWidget: this.isSimpleWidget,
310311
contributions: EditorExtensionsRegistry.getSomeEditorContributions([
311312
MenuPreventer.ID,
312313
SelectionClipboardContributionID,
@@ -543,6 +544,7 @@ export class CodeCompareBlockPart extends Disposable {
543544
readonly menuId: MenuId,
544545
delegate: IChatRendererDelegate,
545546
overflowWidgetsDomNode: HTMLElement | undefined,
547+
private readonly isSimpleWidget: boolean = false,
546548
@IInstantiationService instantiationService: IInstantiationService,
547549
@IContextKeyService contextKeyService: IContextKeyService,
548550
@IModelService protected readonly modelService: IModelService,
@@ -654,7 +656,7 @@ export class CodeCompareBlockPart extends Disposable {
654656

655657
private createDiffEditor(instantiationService: IInstantiationService, parent: HTMLElement, options: Readonly<IEditorConstructionOptions>): DiffEditorWidget {
656658
const widgetOptions: ICodeEditorWidgetOptions = {
657-
isSimpleWidget: false,
659+
isSimpleWidget: this.isSimpleWidget,
658660
contributions: EditorExtensionsRegistry.getSomeEditorContributions([
659661
MenuPreventer.ID,
660662
SelectionClipboardContributionID,

0 commit comments

Comments
 (0)