mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-09 03:17:58 +00:00
feat: add keyboard shortcut for prompt enhancement
- Add Ctrl+Shift+E (Cmd+Shift+E on Mac) keyboard shortcut - Register new command roo-cline.enhancePrompt in VS Code - Connect command to trigger enhance prompt functionality - Update UI tooltip to show keyboard shortcut hint - Add triggerEnhancePrompt action to ExtensionMessage type
This commit is contained in:
parent
9fce90be9d
commit
a563f911da
8 changed files with 41 additions and 2 deletions
|
|
@ -53,6 +53,7 @@ export const commandIds = [
|
|||
"focusInput",
|
||||
"acceptInput",
|
||||
"focusPanel",
|
||||
"enhancePrompt",
|
||||
] as const
|
||||
|
||||
export type CommandId = (typeof commandIds)[number]
|
||||
|
|
|
|||
|
|
@ -218,6 +218,15 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
|
|||
|
||||
visibleProvider.postMessageToWebview({ type: "acceptInput" })
|
||||
},
|
||||
enhancePrompt: () => {
|
||||
const visibleProvider = getVisibleProviderOrLog(outputChannel)
|
||||
|
||||
if (!visibleProvider) {
|
||||
return
|
||||
}
|
||||
|
||||
visibleProvider.postMessageToWebview({ type: "action", action: "triggerEnhancePrompt" as any })
|
||||
},
|
||||
})
|
||||
|
||||
export const openClineInNewTab = async ({ context, outputChannel }: Omit<RegisterCommandOptions, "provider">) => {
|
||||
|
|
|
|||
|
|
@ -174,6 +174,11 @@
|
|||
"command": "roo-cline.acceptInput",
|
||||
"title": "%command.acceptInput.title%",
|
||||
"category": "%configuration.title%"
|
||||
},
|
||||
{
|
||||
"command": "roo-cline.enhancePrompt",
|
||||
"title": "%command.enhancePrompt.title%",
|
||||
"category": "%configuration.title%"
|
||||
}
|
||||
],
|
||||
"menus": {
|
||||
|
|
@ -388,7 +393,15 @@
|
|||
"description": "%settings.autoImportSettingsPath.description%"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"keybindings": [
|
||||
{
|
||||
"command": "roo-cline.enhancePrompt",
|
||||
"key": "ctrl+shift+e",
|
||||
"mac": "cmd+shift+e",
|
||||
"when": "view == roo-cline.SidebarProvider || activeWebviewPanelId == roo-cline.TabPanelProvider"
|
||||
}
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint . --ext=ts --max-warnings=0",
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ export interface ExtensionMessage {
|
|||
| "didBecomeVisible"
|
||||
| "focusInput"
|
||||
| "switchTab"
|
||||
| "triggerEnhancePrompt"
|
||||
invoke?: "newChat" | "sendMessage" | "primaryButtonClick" | "secondaryButtonClick" | "setChatBoxMessage"
|
||||
state?: ExtensionState
|
||||
images?: string[]
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ export interface WebviewMessage {
|
|||
| "diagnosticsEnabled"
|
||||
| "enhancePrompt"
|
||||
| "enhancedPrompt"
|
||||
| "triggerEnhancePrompt"
|
||||
| "draggedImages"
|
||||
| "deleteMessage"
|
||||
| "deleteMessageConfirm"
|
||||
|
|
|
|||
|
|
@ -169,6 +169,10 @@ const App = () => {
|
|||
if (message.type === "acceptInput") {
|
||||
chatViewRef.current?.acceptInput()
|
||||
}
|
||||
|
||||
if (message.type === "action" && message.action === "triggerEnhancePrompt") {
|
||||
chatViewRef.current?.triggerEnhancePrompt()
|
||||
}
|
||||
},
|
||||
[switchTab],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ import { cn } from "@/lib/utils"
|
|||
import { usePromptHistory } from "./hooks/usePromptHistory"
|
||||
import { EditModeControls } from "./EditModeControls"
|
||||
|
||||
const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0
|
||||
|
||||
interface ChatTextAreaProps {
|
||||
inputValue: string
|
||||
setInputValue: (value: string) => void
|
||||
|
|
@ -1110,7 +1112,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
|||
/>
|
||||
|
||||
<div className="absolute top-1 right-1 z-30">
|
||||
<StandardTooltip content={t("chat:enhancePrompt")}>
|
||||
<StandardTooltip content={`${t("chat:enhancePrompt")} (${isMac ? "⌘" : "Ctrl"}+Shift+E)`}>
|
||||
<button
|
||||
aria-label={t("chat:enhancePrompt")}
|
||||
disabled={sendingDisabled}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ export interface ChatViewProps {
|
|||
|
||||
export interface ChatViewRef {
|
||||
acceptInput: () => void
|
||||
triggerEnhancePrompt: () => void
|
||||
}
|
||||
|
||||
export const MAX_IMAGES_PER_MESSAGE = 20 // Anthropic limits to 20 images
|
||||
|
|
@ -1616,6 +1617,13 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
|
|||
handleSendMessage(inputValue, selectedImages)
|
||||
}
|
||||
},
|
||||
triggerEnhancePrompt: () => {
|
||||
// Find the enhance prompt button and trigger its click
|
||||
const enhanceButton = document.querySelector('[aria-label*="enhance"]') as HTMLButtonElement
|
||||
if (enhanceButton && !sendingDisabled) {
|
||||
enhanceButton.click()
|
||||
}
|
||||
},
|
||||
}))
|
||||
|
||||
const handleCondenseContext = (taskId: string) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue