From 5475ef2db3d85a66379e3e69e82a897896b66881 Mon Sep 17 00:00:00 2001 From: David Saz Date: Tue, 5 May 2026 00:24:03 +0200 Subject: [PATCH] Feat/add ide opened file to chat context (#1106) * feat(chat): add active editor file context and related functionality * feat(chat): improve active editor file context handling and update translations * feat(i18n): standardize quotation marks in file attachment messages * update Korean translation for image removal action in file attachment * feat(chat): refine active editor file handling and optimize broadcast logic * fix(chat): stabilize VS Code editor context chips --------- Signed-off-by: David Saz Co-authored-by: Bohdan Triapitsyn --- packages/ui/src/components/chat/ChatInput.tsx | 172 +++++++-------- .../ui/src/components/chat/FileAttachment.tsx | 199 ++++++++++++++++-- packages/ui/src/lib/i18n/messages/en.ts | 3 + packages/ui/src/lib/i18n/messages/es.ts | 3 + packages/ui/src/lib/i18n/messages/ko.ts | 3 + packages/ui/src/lib/i18n/messages/pt-BR.ts | 3 + packages/ui/src/lib/i18n/messages/uk.ts | 3 + packages/ui/src/lib/i18n/messages/zh-CN.ts | 3 + packages/ui/src/stores/types/sessionTypes.ts | 4 +- packages/ui/src/sync/input-store.ts | 113 ++++++++++ packages/vscode/src/ChatViewProvider.ts | 111 ++++++++++ packages/vscode/webview/main.tsx | 8 + 12 files changed, 528 insertions(+), 97 deletions(-) diff --git a/packages/ui/src/components/chat/ChatInput.tsx b/packages/ui/src/components/chat/ChatInput.tsx index da009be6..54a2f420 100644 --- a/packages/ui/src/components/chat/ChatInput.tsx +++ b/packages/ui/src/components/chat/ChatInput.tsx @@ -29,7 +29,7 @@ import { useUserMessageHistory } from '@/sync/sync-context'; import { useInlineCommentDraftStore, type InlineCommentDraft } from '@/stores/useInlineCommentDraftStore'; import { appendInlineComments } from '@/lib/messages/inlineComments'; import { renderMagicPrompt } from '@/lib/magicPrompts'; -import { AttachedFilesList } from './FileAttachment'; +import { AttachedFilesList, AttachedVSCodeFileChips, ActiveEditorFileSuggestion } from './FileAttachment'; import { QueuedMessageChips } from './QueuedMessageChips'; import { FileMentionAutocomplete, type FileMentionHandle } from './FileMentionAutocomplete'; import { CommandAutocomplete, type CommandAutocompleteHandle, type CommandInfo } from './CommandAutocomplete'; @@ -3677,95 +3677,101 @@ const ChatInputComponent: React.FC = ({ onOpenSettings, scrollTo : undefined} /> )} -
- {highlightedComposerContent && ( -
+
+ + +
+
+ {highlightedComposerContent && ( +
+ {highlightedComposerContent.map((part, index) => ( + + {part.text} + + ))} +
+ )} +