diff --git a/src/vs/workbench/contrib/chat/browser/chatInputPart.ts b/src/vs/workbench/contrib/chat/browser/chatInputPart.ts index cc573b86e65..59dd28bc75a 100644 --- a/src/vs/workbench/contrib/chat/browser/chatInputPart.ts +++ b/src/vs/workbench/contrib/chat/browser/chatInputPart.ts @@ -79,7 +79,6 @@ import { ChatInputHistoryMaxEntries, IChatHistoryEntry, IChatInputState, IChatWi import { ChatAgentLocation, ChatConfiguration, ChatMode, isChatMode, validateChatMode } from '../common/constants.js'; import { ILanguageModelChatMetadata, ILanguageModelChatMetadataAndIdentifier, ILanguageModelsService } from '../common/languageModels.js'; import { CancelAction, ChatEditingSessionSubmitAction, ChatOpenModelPickerActionId, ChatSubmitAction, IChatExecuteActionContext, ToggleAgentModeActionId } from './actions/chatExecuteActions.js'; -import { AttachToolsAction } from './actions/chatToolActions.js'; import { ImplicitContextAttachmentWidget } from './attachments/implicitContextAttachment.js'; import { PromptInstructionsAttachmentsCollectionWidget } from './attachments/promptInstructions/promptInstructionsCollectionWidget.js'; import { IChatWidget } from './chat.js'; @@ -1187,10 +1186,6 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge const viewItem = this.instantiationService.createInstance(AddFilesButton, undefined, action, options); return viewItem; } - if (action.id === AttachToolsAction.id) { - // TODO@jrieken let's remove this once the tools picker has its final place. - return this.selectedToolsModel.toolsActionItemViewItemProvider(action, options); - } return undefined; } })); @@ -1200,8 +1195,6 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge this._onDidChangeHeight.fire(); } })); - - this._register(this.selectedToolsModel.toolsActionItemViewItemProvider.onDidRender(() => this._onDidChangeHeight.fire())); } private renderAttachedContext() { diff --git a/src/vs/workbench/contrib/chat/browser/chatSelectedTools.ts b/src/vs/workbench/contrib/chat/browser/chatSelectedTools.ts index aaca80dd775..b068a640bc3 100644 --- a/src/vs/workbench/contrib/chat/browser/chatSelectedTools.ts +++ b/src/vs/workbench/contrib/chat/browser/chatSelectedTools.ts @@ -3,18 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { reset } from '../../../../base/browser/dom.js'; -import { IActionViewItemProvider } from '../../../../base/browser/ui/actionbar/actionbar.js'; -import { IActionViewItemOptions } from '../../../../base/browser/ui/actionbar/actionViewItems.js'; -import { renderLabelWithIcons } from '../../../../base/browser/ui/iconLabel/iconLabels.js'; -import { IAction } from '../../../../base/common/actions.js'; -import { Emitter, Event } from '../../../../base/common/event.js'; import { Disposable } from '../../../../base/common/lifecycle.js'; -import { autorun, derived, IObservable, observableFromEvent } from '../../../../base/common/observable.js'; -import { assertType } from '../../../../base/common/types.js'; -import { localize } from '../../../../nls.js'; -import { MenuEntryActionViewItem } from '../../../../platform/actions/browser/menuEntryActionViewItem.js'; -import { MenuItemAction } from '../../../../platform/actions/common/actions.js'; +import { derived, IObservable, observableFromEvent } from '../../../../base/common/observable.js'; import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js'; import { ObservableMemento, observableMemento } from '../../../../platform/observable/common/observableMemento.js'; import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js'; @@ -41,8 +31,6 @@ export class ChatSelectedTools extends Disposable { readonly tools: IObservable; - readonly toolsActionItemViewItemProvider: IActionViewItemProvider & { onDidRender: Event }; - private readonly _allTools: IObservable[]>; constructor( @@ -77,54 +65,6 @@ export class ChatSelectedTools extends Disposable { !(disabled.toolIds.has(t.id) || disabled.buckets.has(ToolDataSource.toKey(t.source))) ); }); - - const toolsCount = derived(r => { - const count = this._allTools.read(r).length; - const enabled = this.tools.read(r).length; - return { count, enabled }; - }); - - const onDidRender = this._store.add(new Emitter()); - - this.toolsActionItemViewItemProvider = Object.assign( - (action: IAction, options: IActionViewItemOptions) => { - if (!(action instanceof MenuItemAction)) { - return undefined; - } - - return instaService.createInstance(class extends MenuEntryActionViewItem { - - override render(container: HTMLElement): void { - this.options.icon = false; - this.options.label = true; - container.classList.add('chat-mcp', 'chat-attachment-button'); - super.render(container); - } - - protected override updateLabel(): void { - this._store.add(autorun(r => { - assertType(this.label); - - const { enabled, count } = toolsCount.read(r); - - const message = count === 0 - ? '$(tools)' - : enabled !== count - ? localize('tool.1', "{0} {1} of {2}", '$(tools)', enabled, count) - : localize('tool.0', "{0} {1}", '$(tools)', count); - - reset(this.label, ...renderLabelWithIcons(message)); - - if (this.element?.isConnected) { - onDidRender.fire(); - } - })); - } - - }, action, { ...options, keybindingNotRenderedWithLabel: true }); - }, - { onDidRender: onDidRender.event } - ); } selectOnly(toolIds: readonly string[]): void {