fix: improve edit message functionality and add translations

- Add TypeScript documentation for hasSeenEditWarningInSessionRef
- Rename ref to hasSeenEditWarningInSessionRef for clarity
- Consolidate edit warning logic into handleEditMessageDialog callback
- Simplify double-click handler to use native React onDoubleClick event
- Remove select-none class to allow text selection while maintaining double-click edit
- Add tooltips for double-click area and edit button
- Add translations for new tooltip strings in all 17 supported languages
- Fix duplicate key errors in translation files
This commit is contained in:
Daniel Riccio 2025-07-24 17:58:10 -05:00
parent 52031a5706
commit 016a345d4f
No known key found for this signature in database
GPG key ID: FFD5FD825F8E8209
20 changed files with 139 additions and 79 deletions

View file

@ -91,8 +91,12 @@ const App = () => {
messageTs: 0,
})
// Track if the user has seen the edit warning - using ref to persist across renders
const hasSeenEditWarningRef = useRef<boolean>(false)
/**
* Tracks whether the user has seen the edit warning dialog during the current session.
* Uses a ref to persist the value across renders without triggering re-renders.
* Resets when the VS Code window is reloaded.
*/
const hasSeenEditWarningInSessionRef = useRef<boolean>(false)
const [editMessageDialogState, setEditMessageDialogState] = useState<EditMessageDialogState>({
isOpen: false,
@ -126,6 +130,32 @@ const App = () => {
const [currentSection, setCurrentSection] = useState<string | undefined>(undefined)
const [currentMarketplaceTab, setCurrentMarketplaceTab] = useState<string | undefined>(undefined)
/**
* Handles the edit message dialog logic, determining whether to show the warning
* or proceed directly to editing based on session state.
*/
const handleEditMessageDialog = useCallback((message: ExtensionMessage) => {
if (!message.messageTs || !message.text) return
// If the user has already seen the warning in this session, skip the dialog
if (hasSeenEditWarningInSessionRef.current) {
vscode.postMessage({
type: "editMessageConfirm",
messageTs: message.messageTs,
text: message.text,
images: message.images || [],
})
} else {
// Show the warning dialog for the first time in this session
setEditMessageDialogState({
isOpen: true,
messageTs: message.messageTs,
text: message.text,
images: message.images || [],
})
}
}, [])
const onMessage = useCallback(
(e: MessageEvent) => {
const message: ExtensionMessage = e.data
@ -161,30 +191,14 @@ const App = () => {
}
if (message.type === "showEditMessageDialog" && message.messageTs && message.text) {
// If the user has already seen the warning, skip the dialog and directly edit
if (hasSeenEditWarningRef.current) {
vscode.postMessage({
type: "editMessageConfirm",
messageTs: message.messageTs,
text: message.text,
images: message.images || [],
})
} else {
// Show the warning dialog for the first time
setEditMessageDialogState({
isOpen: true,
messageTs: message.messageTs,
text: message.text,
images: message.images || [],
})
}
handleEditMessageDialog(message)
}
if (message.type === "acceptInput") {
chatViewRef.current?.acceptInput()
}
},
[switchTab],
[switchTab, handleEditMessageDialog],
)
useEvent("message", onMessage)
@ -281,8 +295,8 @@ const App = () => {
open={editMessageDialogState.isOpen}
onOpenChange={(open) => setEditMessageDialogState((prev) => ({ ...prev, isOpen: open }))}
onConfirm={() => {
// Mark that the user has seen the edit warning
hasSeenEditWarningRef.current = true
// Mark that the user has seen the edit warning in this session
hasSeenEditWarningInSessionRef.current = true
vscode.postMessage({
type: "editMessageConfirm",
messageTs: editMessageDialogState.messageTs,

View file

@ -177,6 +177,16 @@ export const ChatRowContent = ({
vscode.postMessage({ type: "selectImages", context: "edit", messageTs: message.ts })
}, [message.ts])
// Simple double-click handler
const handleDoubleClick = useCallback(
(e: React.MouseEvent) => {
e.stopPropagation()
e.preventDefault()
handleEditClick()
},
[handleEditClick],
)
const [cost, apiReqCancelReason, apiReqStreamingFailedMessage] = useMemo(() => {
if (message.text !== null && message.text !== undefined && message.say === "api_req_started") {
const info = safeJsonParse<ClineApiReqInfo>(message.text)
@ -1058,6 +1068,7 @@ export const ChatRowContent = ({
</div>
)
case "user_feedback":
// For user feedback messages, always allow editing
return (
<div className="bg-vscode-editor-background border rounded-xs p-1 overflow-hidden whitespace-pre-wrap">
{isEditing ? (
@ -1083,19 +1094,18 @@ export const ChatRowContent = ({
) : (
<div className="flex justify-between">
<div
className="flex-grow px-2 py-1 wrap-anywhere"
onDoubleClick={(e) => {
e.stopPropagation()
handleEditClick()
}}>
className="flex-grow px-2 py-1 wrap-anywhere cursor-pointer"
onDoubleClick={handleDoubleClick}
title={t("chat:editMessage.doubleClickToEdit")}>
<Mention text={message.text} withShadow />
</div>
<div className="flex">
<Button
variant="ghost"
size="icon"
className="shrink-0 hidden"
className="shrink-0"
disabled={isStreaming}
title={t("chat:editMessage.editButton")}
onClick={(e) => {
e.stopPropagation()
handleEditClick()

View file

@ -79,6 +79,11 @@
"title": "Cancel·lar",
"tooltip": "Cancel·la l'operació actual"
},
"editMessage": {
"placeholder": "Edita el teu missatge...",
"doubleClickToEdit": "Doble clic per editar el missatge",
"editButton": "Edita el missatge"
},
"scrollToBottom": "Desplaça't al final del xat",
"about": "Genera, refactoritza i depura codi amb l'ajuda de la IA. Consulta la nostra <DocsLink>documentació</DocsLink> per obtenir més informació.",
"onboarding": "<strong> La vostra llista de tasques en aquest espai de treball està buida. </strong> Comença escrivint una tasca a continuació. \nNo esteu segur per on començar? \nMés informació sobre què pot fer Roo als documents.",
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "Versió {{version}} - Feu clic per veure les notes de llançament"
},
"editMessage": {
"placeholder": "Edita el teu missatge..."
}
}

View file

@ -79,6 +79,11 @@
"title": "Abbrechen",
"tooltip": "Aktuelle Operation abbrechen"
},
"editMessage": {
"placeholder": "Bearbeite deine Nachricht ...",
"doubleClickToEdit": "Doppelklick zum Bearbeiten",
"editButton": "Nachricht bearbeiten"
},
"scrollToBottom": "Zum Chat-Ende scrollen",
"about": "Generiere, überarbeite und debugge Code mit KI-Unterstützung. Weitere Informationen findest du in unserer <DocsLink>Dokumentation</DocsLink>.",
"onboarding": "<strong>Deine Aufgabenliste in diesem Arbeitsbereich ist leer.</strong> Beginne mit der Eingabe einer Aufgabe unten. Du bist dir nicht sicher, wie du anfangen sollst? Lies mehr darüber, was Roo für dich tun kann, in <DocsLink>den Dokumenten</DocsLink>.",
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "Version {{version}} - Klicken Sie, um die Versionshinweise anzuzeigen"
},
"editMessage": {
"placeholder": "Bearbeite deine Nachricht..."
}
}

View file

@ -88,7 +88,9 @@
"tooltip": "Cancel the current operation"
},
"editMessage": {
"placeholder": "Edit your message..."
"placeholder": "Edit your message...",
"doubleClickToEdit": "Double-click to edit message",
"editButton": "Edit message"
},
"scrollToBottom": "Scroll to bottom of chat",
"about": "Generate, refactor, and debug code with AI assistance. Check out our <DocsLink>documentation</DocsLink> to learn more.",

View file

@ -79,6 +79,11 @@
"title": "Cancelar",
"tooltip": "Cancelar la operación actual"
},
"editMessage": {
"placeholder": "Edita tu mensaje...",
"doubleClickToEdit": "Doble clic para editar el mensaje",
"editButton": "Editar mensaje"
},
"scrollToBottom": "Desplazarse al final del chat",
"about": "Genera, refactoriza y depura código con asistencia de IA. Consulta nuestra <DocsLink>documentación</DocsLink> para obtener más información.",
"onboarding": "<strong>Tu lista de tareas en este espacio de trabajo está vacía.</strong> Comienza escribiendo una tarea abajo. ¿No estás seguro cómo empezar? Lee más sobre lo que Roo puede hacer por ti en <DocsLink>la documentación</DocsLink>.",
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "Versión {{version}} - Haz clic para ver las notas de la versión"
},
"editMessage": {
"placeholder": "Edita tu mensaje..."
}
}

View file

@ -79,6 +79,11 @@
"title": "Annuler",
"tooltip": "Annuler l'opération actuelle"
},
"editMessage": {
"placeholder": "Modifiez votre message...",
"doubleClickToEdit": "Double-cliquez pour modifier",
"editButton": "Modifier le message"
},
"scrollToBottom": "Défiler jusqu'au bas du chat",
"about": "Générer, refactoriser et déboguer du code avec l'assistance de l'IA. Consultez notre <DocsLink>documentation</DocsLink> pour en savoir plus.",
"onboarding": "Grâce aux dernières avancées en matière de capacités de codage agent, je peux gérer des tâches complexes de développement logiciel étape par étape. Avec des outils qui me permettent de créer et d'éditer des fichiers, d'explorer des projets complexes, d'utiliser le navigateur et d'exécuter des commandes de terminal (après votre autorisation), je peux vous aider de manières qui vont au-delà de la complétion de code ou du support technique. Je peux même utiliser MCP pour créer de nouveaux outils et étendre mes propres capacités.",
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "Version {{version}} - Cliquez pour voir les notes de version"
},
"editMessage": {
"placeholder": "Modifiez votre message..."
}
}

View file

@ -79,6 +79,11 @@
"title": "रद्द करें",
"tooltip": "वर्तमान ऑपरेशन रद्द करें"
},
"editMessage": {
"placeholder": "अपना संदेश संपादित करें...",
"doubleClickToEdit": "संपादित करने के लिए डबल-क्लिक करें",
"editButton": "संदेश संपादित करें"
},
"scrollToBottom": "चैट के निचले हिस्से तक स्क्रॉल करें",
"about": "एआई सहायता से कोड जेनरेट करें, रिफैक्टर करें और डिबग करें। अधिक जानने के लिए हमारे <DocsLink>दस्तावेज़</DocsLink> देखें।",
"onboarding": "एजेंटिक कोडिंग क्षमताओं में नवीनतम प्रगति के कारण, मैं जटिल सॉफ्टवेयर विकास कार्यों को चरण-दर-चरण संभाल सकता हूं। ऐसे उपकरणों के साथ जो मुझे फ़ाइलें बनाने और संपादित करने, जटिल प्रोजेक्ट का अन्वेषण करने, ब्राउज़र का उपयोग करने और टर्मिनल कमांड (आपकी अनुमति के बाद) निष्पादित करने की अनुमति देते हैं, मैं आपकी मदद कोड पूर्णता या तकनीकी समर्थन से परे तरीकों से कर सकता हूं। मैं अपनी क्षमताओं का विस्तार करने और नए उपकरण बनाने के लिए MCP का भी उपयोग कर सकता हूं।",
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "संस्करण {{version}} - रिलीज़ नोट्स देखने के लिए क्लिक करें"
},
"editMessage": {
"placeholder": "अपना संदेश संपादित करें..."
}
}

View file

@ -93,6 +93,11 @@
"title": "Batal",
"tooltip": "Batalkan operasi saat ini"
},
"editMessage": {
"placeholder": "Ubah pesan Anda...",
"doubleClickToEdit": "Klik dua kali untuk mengubah",
"editButton": "Ubah pesan"
},
"scrollToBottom": "Gulir ke bawah chat",
"about": "Buat, refaktor, dan debug kode dengan bantuan AI.<br />Lihat <DocsLink>dokumentasi</DocsLink> kami untuk mempelajari lebih lanjut.",
"onboarding": "Daftar tugas di workspace ini kosong.",
@ -328,8 +333,5 @@
},
"versionIndicator": {
"ariaLabel": "Versi {{version}} - Klik untuk melihat catatan rilis"
},
"editMessage": {
"placeholder": "Edit pesan Anda..."
}
}

View file

@ -79,6 +79,11 @@
"title": "Annulla",
"tooltip": "Annulla l'operazione corrente"
},
"editMessage": {
"placeholder": "Modifica il tuo messaggio...",
"doubleClickToEdit": "Fai doppio clic per modificare",
"editButton": "Modifica messaggio"
},
"scrollToBottom": "Scorri fino alla fine della chat",
"about": "Genera, refactor e debug del codice con l'assistenza dell'IA. Consulta la nostra <DocsLink>documentazione</DocsLink> per saperne di più.",
"onboarding": "Grazie alle più recenti innovazioni nelle capacità di codifica agentica, posso gestire complesse attività di sviluppo software passo dopo passo. Con strumenti che mi permettono di creare e modificare file, esplorare progetti complessi, utilizzare il browser ed eseguire comandi da terminale (dopo la tua autorizzazione), posso aiutarti in modi che vanno oltre il completamento del codice o il supporto tecnico. Posso persino usare MCP per creare nuovi strumenti ed estendere le mie capacità.",
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "Versione {{version}} - Clicca per visualizzare le note di rilascio"
},
"editMessage": {
"placeholder": "Modifica il tuo messaggio..."
}
}

View file

@ -79,6 +79,11 @@
"title": "キャンセル",
"tooltip": "現在の操作をキャンセル"
},
"editMessage": {
"placeholder": "メッセージを編集...",
"doubleClickToEdit": "ダブルクリックして編集",
"editButton": "メッセージを編集"
},
"scrollToBottom": "チャットの最下部にスクロール",
"about": "AI支援でコードを生成、リファクタリング、デバッグします。詳細については、<DocsLink>ドキュメント</DocsLink>をご覧ください。",
"onboarding": "最新のエージェント型コーディング能力の進歩により、複雑なソフトウェア開発タスクをステップバイステップで処理できます。ファイルの作成や編集、複雑なプロジェクトの探索、ブラウザの使用、ターミナルコマンドの実行許可後を可能にするツールにより、コード補完や技術サポート以上の方法であなたをサポートできます。MCPを使用して新しいツールを作成し、自分の能力を拡張することもできます。",
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "バージョン {{version}} - クリックしてリリースノートを表示"
},
"editMessage": {
"placeholder": "メッセージを編集..."
}
}

View file

@ -79,7 +79,12 @@
"title": "취소",
"tooltip": "현재 작업 취소"
},
"scrollToBottom": "채팅 하단으로 스크롤",
"editMessage": {
"placeholder": "메시지 수정...",
"doubleClickToEdit": "메시지를 수정하려면 두 번 클릭하세요",
"editButton": "메시지 수정"
},
"scrollToBottom": "채팅 하단으로 스크ロール",
"about": "AI 지원으로 코드를 생성, 리팩터링 및 디버깅합니다. 자세한 내용은 <DocsLink>문서</DocsLink>를 확인하세요.",
"onboarding": "<strong>이 작업 공간의 작업 목록이 비어 있습니다.</strong> 아래에 작업을 입력하여 시작하세요. 어떻게 시작해야 할지 모르겠나요? Roo가 무엇을 할 수 있는지 <DocsLink>문서</DocsLink>에서 자세히 알아보세요.",
"rooTips": {
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "버전 {{version}} - 릴리스 노트를 보려면 클릭하세요"
},
"editMessage": {
"placeholder": "메시지 편집..."
}
}

View file

@ -79,6 +79,11 @@
"title": "Annuleren",
"tooltip": "Annuleer de huidige bewerking"
},
"editMessage": {
"placeholder": "Bewerk je bericht...",
"doubleClickToEdit": "Dubbelklik om te bewerken",
"editButton": "Bewerk bericht"
},
"scrollToBottom": "Scroll naar onderaan de chat",
"about": "Genereer, refactor en debug code met AI-assistentie. Bekijk onze <DocsLink>documentatie</DocsLink> voor meer informatie.",
"onboarding": "Je takenlijst in deze werkruimte is leeg.",
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "Versie {{version}} - Klik om release notes te bekijken"
},
"editMessage": {
"placeholder": "Bewerk je bericht..."
}
}

View file

@ -79,6 +79,11 @@
"title": "Anuluj",
"tooltip": "Anuluj bieżącą operację"
},
"editMessage": {
"placeholder": "Edytuj wiadomość...",
"doubleClickToEdit": "Kliknij dwukrotnie, aby edytować",
"editButton": "Edytuj wiadomość"
},
"scrollToBottom": "Przewiń do dołu czatu",
"about": "Generuj, refaktoryzuj i debuguj kod z pomocą sztucznej inteligencji. Sprawdź naszą <DocsLink>dokumentację</DocsLink>, aby dowiedzieć się więcej.",
"onboarding": "<strong>Twoja lista zadań w tym obszarze roboczym jest pusta.</strong> Zacznij od wpisania zadania poniżej. Nie wiesz, jak zacząć? Przeczytaj więcej o tym, co Roo może dla Ciebie zrobić w <DocsLink>dokumentacji</DocsLink>.",
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "Wersja {{version}} - Kliknij, aby wyświetlić informacje o wydaniu"
},
"editMessage": {
"placeholder": "Edytuj swoją wiadomość..."
}
}

View file

@ -79,6 +79,11 @@
"title": "Cancelar",
"tooltip": "Cancelar a operação atual"
},
"editMessage": {
"placeholder": "Edite sua mensagem...",
"doubleClickToEdit": "Clique duas vezes para editar a mensagem",
"editButton": "Editar mensagem"
},
"scrollToBottom": "Rolar para o final do chat",
"about": "Gere, refatore e depure código com assistência de IA. Confira nossa <DocsLink>documentação</DocsLink> para saber mais.",
"onboarding": "<strong>Sua lista de tarefas neste espaço de trabalho está vazia.</strong> Comece digitando uma tarefa abaixo. Não sabe como começar? Leia mais sobre o que o Roo pode fazer por você nos <DocsLink>documentos</DocsLink>.",
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "Versão {{version}} - Clique para ver as notas de lançamento"
},
"editMessage": {
"placeholder": "Edite sua mensagem..."
}
}

View file

@ -79,6 +79,11 @@
"title": "Отмена",
"tooltip": "Отменить текущую операцию"
},
"editMessage": {
"placeholder": "Отредактируйте свое сообщение...",
"doubleClickToEdit": "Дважды щелкните, чтобы отредактировать",
"editButton": "Редактировать сообщение"
},
"scrollToBottom": "Прокрутить чат вниз",
"about": "Создавайте, рефакторите и отлаживайте код с помощью ИИ. Подробнее см. в нашей <DocsLink>документации</DocsLink>.",
"rooTips": {
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "Версия {{version}} - Нажмите, чтобы просмотреть примечания к выпуску"
},
"editMessage": {
"placeholder": "Редактировать сообщение..."
}
}

View file

@ -79,6 +79,11 @@
"title": "İptal",
"tooltip": "Mevcut işlemi iptal et"
},
"editMessage": {
"placeholder": "Mesajınızı düzenleyin...",
"doubleClickToEdit": "Düzenlemek için çift tıklayın",
"editButton": "Mesajı düzenle"
},
"scrollToBottom": "Sohbetin altına kaydır",
"about": "AI yardımıyla kod oluşturun, yeniden düzenleyin ve hatalarını ayıklayın. Daha fazla bilgi edinmek için <DocsLink>belgelerimize</DocsLink> göz atın.",
"onboarding": "<strong>Bu çalışma alanındaki görev listeniz boş.</strong> Aşağıya bir görev yazarak başlayın. Nasıl başlayacağınızdan emin değil misiniz? Roo'nun sizin için neler yapabileceği hakkında daha fazla bilgiyi <DocsLink>belgelerde</DocsLink> okuyun.",
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "Sürüm {{version}} - Sürüm notlarını görüntülemek için tıklayın"
},
"editMessage": {
"placeholder": "Mesajını düzenle..."
}
}

View file

@ -79,6 +79,11 @@
"title": "Hủy",
"tooltip": "Hủy thao tác hiện tại"
},
"editMessage": {
"placeholder": "Chỉnh sửa tin nhắn của bạn...",
"doubleClickToEdit": "Nhấp đúp để chỉnh sửa tin nhắn",
"editButton": "Chỉnh sửa tin nhắn"
},
"scrollToBottom": "Cuộn xuống cuối cuộc trò chuyện",
"about": "Tạo, tái cấu trúc và gỡ lỗi mã bằng sự hỗ trợ của AI. Kiểm tra <DocsLink>tài liệu</DocsLink> của chúng tôi để tìm hiểu thêm.",
"onboarding": "<strong>Danh sách nhiệm vụ của bạn trong không gian làm việc này trống.</strong> Bắt đầu bằng cách nhập nhiệm vụ bên dưới. Bạn không chắc chắn nên bắt đầu như thế nào? Đọc thêm về những gì Roo có thể làm cho bạn trong <DocsLink>tài liệu</DocsLink>.",
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "Phiên bản {{version}} - Nhấp để xem ghi chú phát hành"
},
"editMessage": {
"placeholder": "Chỉnh sửa tin nhắn của bạn..."
}
}

View file

@ -79,6 +79,11 @@
"title": "取消",
"tooltip": "取消当前操作"
},
"editMessage": {
"placeholder": "编辑你的消息...",
"doubleClickToEdit": "双击编辑",
"editButton": "编辑消息"
},
"scrollToBottom": "滚动到聊天底部",
"about": "通过 AI 辅助生成、重构和调试代码。查看我们的 <DocsLink>文档</DocsLink> 了解更多信息。",
"onboarding": "<strong>此工作区中的任务列表为空。</strong> 请在下方输入任务开始。 不确定如何开始? 在 <DocsLink>文档</DocsLink> 中阅读更多关于 Roo 可以为您做什么的信息。",
@ -322,8 +327,5 @@
},
"versionIndicator": {
"ariaLabel": "版本 {{version}} - 点击查看发布说明"
},
"editMessage": {
"placeholder": "编辑消息..."
}
}

View file

@ -324,6 +324,8 @@
"ariaLabel": "版本 {{version}} - 點擊查看發布說明"
},
"editMessage": {
"placeholder": "編輯訊息..."
"placeholder": "編輯你的訊息...",
"doubleClickToEdit": "雙擊編輯",
"editButton": "編輯訊息"
}
}