Не подтверждена Коммит 8854c84d создал по автору Bhavya U's avatar Bhavya U Зафиксировано автором GitHub
Просмотр файлов

Add option to render todo list near chat input (#268392)

* Add todo list rendering in chat input and update styles

* Refactor todo list rendering logic to use widget position settings and remove deprecated configuration

* Refactor chat input to integrate ChatTodoListWidget and remove unused IChatTodoListService

* Refactor ChatInputPart to remove unused todo state management and improve session handling for todo list widget

* Integrate ChatTodoListWidget into ChatInputPart and update rendering logic in ChatWidget

* Remove redundant todo state reset logic on chat session change in ChatInputPart

* Remove unnecessary blank line in ChatInputPart class

* Simplify condition check for rendering working set in ChatInputPart

* Remove unused CSS rules for chat editing session todos in interactive session
владелец a2443a68
......@@ -98,6 +98,7 @@ import { ChatDragAndDrop } from './chatDragAndDrop.js';
import { ChatEditingShowChangesAction, ViewPreviousEditsAction } from './chatEditing/chatEditingActions.js';
import { ChatFollowups } from './chatFollowups.js';
import { ChatSelectedTools } from './chatSelectedTools.js';
import { ChatTodoListWidget } from './chatContentParts/chatTodoListWidget.js';
import { IChatViewState } from './chatWidget.js';
import { ChatImplicitContext } from './contrib/chatImplicitContext.js';
import { ChatRelatedFiles } from './contrib/chatInputRelatedFilesContrib.js';
......@@ -143,6 +144,8 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
private static _counter = 0;
private _workingSetCollapsed = true;
private readonly _chatInputTodoListWidget = this._register(new MutableDisposable<ChatTodoListWidget>());
private readonly _chatEditingTodosDisposables = this._register(new DisposableStore());
private _lastEditingSessionId: string | undefined;
private _onDidLoadInputState: Emitter<IChatInputState | undefined>;
......@@ -237,6 +240,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
private relatedFilesContainer!: HTMLElement;
private chatEditingSessionWidgetContainer!: HTMLElement;
private chatInputTodoListWidgetContainer!: HTMLElement;
private _inputPartHeight: number;
get inputPartHeight() {
......@@ -1066,6 +1070,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
if (this.options.renderStyle === 'compact') {
elements = dom.h('.interactive-input-part', [
dom.h('.interactive-input-and-edit-session', [
dom.h('.chat-todo-list-widget-container@chatInputTodoListWidgetContainer'),
dom.h('.chat-editing-session@chatEditingSessionWidgetContainer'),
dom.h('.interactive-input-and-side-toolbar@inputAndSideToolbar', [
dom.h('.chat-input-container@inputContainer', [
......@@ -1084,6 +1089,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
} else {
elements = dom.h('.interactive-input-part', [
dom.h('.interactive-input-followups@followupsContainer'),
dom.h('.chat-todo-list-widget-container@chatInputTodoListWidgetContainer'),
dom.h('.chat-editing-session@chatEditingSessionWidgetContainer'),
dom.h('.interactive-input-and-side-toolbar@inputAndSideToolbar', [
dom.h('.chat-input-container@inputContainer', [
......@@ -1113,6 +1119,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
const toolbarsContainer = elements.inputToolbars;
const attachmentToolbarContainer = elements.attachmentToolbar;
this.chatEditingSessionWidgetContainer = elements.chatEditingSessionWidgetContainer;
this.chatInputTodoListWidgetContainer = elements.chatInputTodoListWidgetContainer;
if (this.options.enableImplicitContext) {
this._implicitContext = this._register(
this.instantiationService.createInstance(ChatImplicitContext),
......@@ -1578,6 +1585,25 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
}
}
async renderChatTodoListWidget(chatSessionId: string) {
if (!this._chatInputTodoListWidget.value) {
const widget = this._chatEditingTodosDisposables.add(this.instantiationService.createInstance(ChatTodoListWidget));
this._chatInputTodoListWidget.value = widget;
// Add the widget's DOM node to the dedicated todo list container
dom.clearNode(this.chatInputTodoListWidgetContainer);
dom.append(this.chatInputTodoListWidgetContainer, widget.domNode);
// Listen to height changes
this._chatEditingTodosDisposables.add(widget.onDidChangeHeight(() => {
this._onDidChangeHeight.fire();
}));
}
// Render the widget with the current session
this._chatInputTodoListWidget.value.render(chatSessionId);
}
async renderChatEditingSessionState(chatEditingSession: IChatEditingSession | null) {
dom.setVisibility(Boolean(chatEditingSession), this.chatEditingSessionWidgetContainer);
......@@ -1854,7 +1880,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
const followupsWidth = width - data.inputPartHorizontalPadding;
this.followupsContainer.style.width = `${followupsWidth}px`;
this._inputPartHeight = data.inputPartVerticalPadding + data.followupsHeight + inputEditorHeight + data.inputEditorBorder + data.attachmentsHeight + data.toolbarsHeight + data.chatEditingStateHeight;
this._inputPartHeight = data.inputPartVerticalPadding + data.followupsHeight + inputEditorHeight + data.inputEditorBorder + data.attachmentsHeight + data.toolbarsHeight + data.chatEditingStateHeight + data.todoListWidgetContainerHeight;
this._followupsHeight = data.followupsHeight;
this._editSessionWidgetHeight = data.chatEditingStateHeight;
......@@ -1892,6 +1918,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
toolbarsHeight: this.options.renderStyle === 'compact' ? 0 : 22,
chatEditingStateHeight: this.chatEditingSessionWidgetContainer.offsetHeight,
sideToolbarWidth: this.inputSideToolbarContainer ? dom.getTotalWidth(this.inputSideToolbarContainer) + 4 /*gap*/ : 0,
todoListWidgetContainerHeight: this.chatInputTodoListWidgetContainer.offsetHeight,
};
}
......
......@@ -1251,10 +1251,23 @@ export class ChatWidget extends Disposable implements IChatWidget {
}
const todoListWidgetPosition = this.configurationService.getValue<string>(TodoListWidgetPositionSettingId) || 'default';
if (todoListWidgetPosition !== 'default') {
// Handle 'off' - hide the widget and return
if (todoListWidgetPosition === 'off') {
this.chatTodoListWidget.domNode.style.display = 'none';
this._onDidChangeContentHeight.fire();
return;
}
// Handle 'chat-input' - hide the standalone widget to avoid duplication
if (todoListWidgetPosition === 'chat-input') {
this.chatTodoListWidget.domNode.style.display = 'none';
this.inputPart.renderChatTodoListWidget(sessionId);
this._onDidChangeContentHeight.fire();
return;
}
// Handle 'default' - render the widget if there are todos
const todos = this.chatTodoListService.getTodos(sessionId);
if (todos.length > 0) {
this.chatTodoListWidget.render(sessionId);
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать