Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@
"command": "roo-cline.focusInput",
"title": "%command.focusInput.title%",
"category": "%extension.displayName%"
},
{
"command": "roo.acceptInput",
"title": "%command.acceptInput.title%",
"category": "%extension.displayName%"
}
],
"menus": {
Expand Down
1 change: 1 addition & 0 deletions package.nls.ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"command.terminal.explainCommand.title": "Explicar Aquesta Ordre",
"command.terminal.fixCommandInCurrentTask.title": "Corregir Aquesta Ordre (Tasca Actual)",
"command.terminal.explainCommandInCurrentTask.title": "Explicar Aquesta Ordre (Tasca Actual)",
"command.acceptInput.title": "Acceptar Entrada/Suggeriment",
"views.activitybar.title": "Roo Code",
"views.contextMenu.label": "Roo Code",
"views.terminalMenu.label": "Roo Code",
Expand Down
1 change: 1 addition & 0 deletions package.nls.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"command.terminal.explainCommand.title": "Diesen Befehl Erklären",
"command.terminal.fixCommandInCurrentTask.title": "Diesen Befehl Reparieren (Aktuelle Aufgabe)",
"command.terminal.explainCommandInCurrentTask.title": "Diesen Befehl Erklären (Aktuelle Aufgabe)",
"command.acceptInput.title": "Eingabe/Vorschlag Akzeptieren",
"views.activitybar.title": "Roo Code",
"views.contextMenu.label": "Roo Code",
"views.terminalMenu.label": "Roo Code",
Expand Down
1 change: 1 addition & 0 deletions package.nls.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"command.terminal.explainCommand.title": "Explicar Este Comando",
"command.terminal.fixCommandInCurrentTask.title": "Corregir Este Comando (Tarea Actual)",
"command.terminal.explainCommandInCurrentTask.title": "Explicar Este Comando (Tarea Actual)",
"command.acceptInput.title": "Aceptar Entrada/Sugerencia",
"views.activitybar.title": "Roo Code",
"views.contextMenu.label": "Roo Code",
"views.terminalMenu.label": "Roo Code",
Expand Down
1 change: 1 addition & 0 deletions package.nls.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"command.terminal.explainCommand.title": "Expliquer cette Commande",
"command.terminal.fixCommandInCurrentTask.title": "Corriger cette Commande (Tâche Actuelle)",
"command.terminal.explainCommandInCurrentTask.title": "Expliquer cette Commande (Tâche Actuelle)",
"command.acceptInput.title": "Accepter l'Entrée/Suggestion",
"views.activitybar.title": "Roo Code",
"views.contextMenu.label": "Roo Code",
"views.terminalMenu.label": "Roo Code",
Expand Down
1 change: 1 addition & 0 deletions package.nls.hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"command.terminal.explainCommand.title": "यह कमांड समझाएं",
"command.terminal.fixCommandInCurrentTask.title": "यह कमांड ठीक करें (वर्तमान कार्य)",
"command.terminal.explainCommandInCurrentTask.title": "यह कमांड समझाएं (वर्तमान कार्य)",
"command.acceptInput.title": "इनपुट/सुझाव स्वीकारें",
"views.activitybar.title": "Roo Code",
"views.contextMenu.label": "Roo Code",
"views.terminalMenu.label": "Roo Code",
Expand Down
1 change: 1 addition & 0 deletions package.nls.it.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"command.terminal.explainCommand.title": "Spiega Questo Comando",
"command.terminal.fixCommandInCurrentTask.title": "Correggi Questo Comando (Task Corrente)",
"command.terminal.explainCommandInCurrentTask.title": "Spiega Questo Comando (Task Corrente)",
"command.acceptInput.title": "Accetta Input/Suggerimento",
"views.activitybar.title": "Roo Code",
"views.contextMenu.label": "Roo Code",
"views.terminalMenu.label": "Roo Code",
Expand Down
1 change: 1 addition & 0 deletions package.nls.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"command.terminal.explainCommand.title": "このコマンドを説明",
"command.terminal.fixCommandInCurrentTask.title": "このコマンドを修正(現在のタスク)",
"command.terminal.explainCommandInCurrentTask.title": "このコマンドを説明(現在のタスク)",
"command.acceptInput.title": "入力/提案を承認",
"configuration.title": "Roo Code",
"commands.allowedCommands.description": "'常に実行操作を承認する'が有効な場合に自動実行できるコマンド",
"settings.vsCodeLmModelSelector.description": "VSCode 言語モデル API の設定",
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"command.terminal.explainCommand.title": "Explain This Command",
"command.terminal.fixCommandInCurrentTask.title": "Fix This Command (Current Task)",
"command.terminal.explainCommandInCurrentTask.title": "Explain This Command (Current Task)",
"command.acceptInput.title": "Accept Input/Suggestion",
"configuration.title": "Roo Code",
"commands.allowedCommands.description": "Commands that can be auto-executed when 'Always approve execute operations' is enabled",
"settings.vsCodeLmModelSelector.description": "Settings for VSCode Language Model API",
Expand Down
1 change: 1 addition & 0 deletions package.nls.ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"command.terminal.explainCommand.title": "이 명령어 설명",
"command.terminal.fixCommandInCurrentTask.title": "이 명령어 수정 (현재 작업)",
"command.terminal.explainCommandInCurrentTask.title": "이 명령어 설명 (현재 작업)",
"command.acceptInput.title": "입력/제안 수락",
"views.activitybar.title": "Roo Code",
"views.contextMenu.label": "Roo Code",
"views.terminalMenu.label": "Roo Code",
Expand Down
1 change: 1 addition & 0 deletions package.nls.pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"command.terminal.explainCommand.title": "Wyjaśnij tę Komendę",
"command.terminal.fixCommandInCurrentTask.title": "Napraw tę Komendę (Bieżące Zadanie)",
"command.terminal.explainCommandInCurrentTask.title": "Wyjaśnij tę Komendę (Bieżące Zadanie)",
"command.acceptInput.title": "Akceptuj Wprowadzanie/Sugestię",
"views.activitybar.title": "Roo Code",
"views.contextMenu.label": "Roo Code",
"views.terminalMenu.label": "Roo Code",
Expand Down
1 change: 1 addition & 0 deletions package.nls.pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"command.terminal.explainCommand.title": "Explicar Este Comando",
"command.terminal.fixCommandInCurrentTask.title": "Corrigir Este Comando (Tarefa Atual)",
"command.terminal.explainCommandInCurrentTask.title": "Explicar Este Comando (Tarefa Atual)",
"command.acceptInput.title": "Aceitar Entrada/Sugestão",
"views.activitybar.title": "Roo Code",
"views.contextMenu.label": "Roo Code",
"views.terminalMenu.label": "Roo Code",
Expand Down
1 change: 1 addition & 0 deletions package.nls.tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"command.terminal.explainCommand.title": "Bu Komutu Açıkla",
"command.terminal.fixCommandInCurrentTask.title": "Bu Komutu Düzelt (Mevcut Görev)",
"command.terminal.explainCommandInCurrentTask.title": "Bu Komutu Açıkla (Mevcut Görev)",
"command.acceptInput.title": "Girişi/Öneriyi Kabul Et",
"views.activitybar.title": "Roo Code",
"views.contextMenu.label": "Roo Code",
"views.terminalMenu.label": "Roo Code",
Expand Down
1 change: 1 addition & 0 deletions package.nls.vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"command.terminal.explainCommand.title": "Giải Thích Lệnh Này",
"command.terminal.fixCommandInCurrentTask.title": "Sửa Lệnh Này (Tác Vụ Hiện Tại)",
"command.terminal.explainCommandInCurrentTask.title": "Giải Thích Lệnh Này (Tác Vụ Hiện Tại)",
"command.acceptInput.title": "Chấp Nhận Đầu Vào/Gợi Ý",
"views.activitybar.title": "Roo Code",
"views.contextMenu.label": "Roo Code",
"views.terminalMenu.label": "Roo Code",
Expand Down
1 change: 1 addition & 0 deletions package.nls.zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"command.terminal.explainCommand.title": "解释此命令",
"command.terminal.fixCommandInCurrentTask.title": "修复此命令(当前任务)",
"command.terminal.explainCommandInCurrentTask.title": "解释此命令(当前任务)",
"command.acceptInput.title": "接受输入/建议",
"views.activitybar.title": "Roo Code",
"views.contextMenu.label": "Roo Code",
"views.terminalMenu.label": "Roo Code",
Expand Down
1 change: 1 addition & 0 deletions package.nls.zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"command.terminal.explainCommand.title": "解釋此命令",
"command.terminal.fixCommandInCurrentTask.title": "修復此命令(當前任務)",
"command.terminal.explainCommandInCurrentTask.title": "解釋此命令(當前任務)",
"command.acceptInput.title": "接受輸入/建議",
"views.activitybar.title": "Roo Code",
"views.contextMenu.label": "Roo Code",
"views.terminalMenu.label": "Roo Code",
Expand Down
5 changes: 5 additions & 0 deletions src/activate/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
"roo-cline.focusInput": () => {
provider.postMessageToWebview({ type: "action", action: "focusInput" })
},
"roo.acceptInput": () => {
const visibleProvider = getVisibleProviderOrLog(outputChannel)
if (!visibleProvider) return
visibleProvider.postMessageToWebview({ type: "acceptInput" })
},
}
}

Expand Down
1 change: 1 addition & 0 deletions src/shared/ExtensionMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export interface ExtensionMessage {
| "maxReadFileLine"
| "fileSearchResults"
| "toggleApiConfigPin"
| "acceptInput"
text?: string
action?:
| "chatButtonClicked"
Expand Down
8 changes: 7 additions & 1 deletion webview-ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import TranslationProvider from "./i18n/TranslationContext"
import { vscode } from "./utils/vscode"
import { telemetryClient } from "./utils/TelemetryClient"
import { ExtensionStateContextProvider, useExtensionState } from "./context/ExtensionStateContext"
import ChatView from "./components/chat/ChatView"
import ChatView, { ChatViewRef } from "./components/chat/ChatView"
import HistoryView from "./components/history/HistoryView"
import SettingsView, { SettingsViewRef } from "./components/settings/SettingsView"
import WelcomeView from "./components/welcome/WelcomeView"
Expand Down Expand Up @@ -44,6 +44,7 @@ const App = () => {
})

const settingsRef = useRef<SettingsViewRef>(null)
const chatViewRef = useRef<ChatViewRef>(null)

const switchTab = useCallback((newTab: Tab) => {
setCurrentSection(undefined)
Expand Down Expand Up @@ -75,6 +76,10 @@ const App = () => {
const { requestId, promptText } = message
setHumanRelayDialogState({ isOpen: true, requestId, promptText })
}

if (message.type === "acceptInput") {
chatViewRef.current?.acceptInput()
}
},
[switchTab],
)
Expand Down Expand Up @@ -114,6 +119,7 @@ const App = () => {
<SettingsView ref={settingsRef} onDone={() => setTab("chat")} targetSection={currentSection} />
)}
<ChatView
ref={chatViewRef}
isHidden={tab !== "chat"}
showAnnouncement={showAnnouncement}
hideAnnouncement={() => setShowAnnouncement(false)}
Expand Down
23 changes: 21 additions & 2 deletions webview-ui/src/components/chat/ChatView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
import debounce from "debounce"
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react"
import { useDeepCompareEffect, useEvent, useMount } from "react-use"
import { Virtuoso, type VirtuosoHandle } from "react-virtuoso"
import styled from "styled-components"
Expand Down Expand Up @@ -40,11 +40,18 @@ interface ChatViewProps {
showHistoryView: () => void
}

export interface ChatViewRef {
acceptInput: () => void
}

export const MAX_IMAGES_PER_MESSAGE = 20 // Anthropic limits to 20 images

const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0

const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryView }: ChatViewProps) => {
const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewProps> = (
{ isHidden, showAnnouncement, hideAnnouncement, showHistoryView },
ref,
) => {
const { t } = useAppTranslation()
const modeShortcutText = `${isMac ? "⌘" : "Ctrl"} + . ${t("chat:forNextMode")}`
const {
Expand Down Expand Up @@ -1162,6 +1169,16 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
}
}, [handleKeyDown])

useImperativeHandle(ref, () => ({
acceptInput: () => {
if (enableButtons && primaryButtonText) {
handlePrimaryButtonClick(inputValue, selectedImages)
} else if (!textAreaDisabled && (inputValue.trim() || selectedImages.length > 0)) {
handleSendMessage(inputValue, selectedImages)
}
},
}))

return (
<div
style={{
Expand Down Expand Up @@ -1386,6 +1403,8 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
)
}

const ChatView = forwardRef(ChatViewComponent)

const ScrollToBottomButton = styled.div`
background-color: color-mix(in srgb, var(--vscode-toolbar-hoverBackground) 55%, transparent);
border-radius: 3px;
Expand Down