Skip to content

Commit 01a4873

Browse files
authored
Add ability to send context with an options selection (RooCodeInc#2379)
* - add ability to send context with an options selection - add sourcemaps for debugging in the webview * remove colon if there is no message * resolve conflicts * remove sourcemap
1 parent 4add380 commit 01a4873

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": patch
3+
---
4+
5+
Allow user to send context with an option selection

webview-ui/src/components/chat/ChatRow.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ interface ChatRowProps {
4949
lastModifiedMessage?: ClineMessage
5050
isLast: boolean
5151
onHeightChange: (isTaller: boolean) => void
52+
inputValue?: string
5253
}
5354

5455
interface ChatRowContentProps extends Omit<ChatRowProps, "onHeightChange"> {}
@@ -84,7 +85,7 @@ const Markdown = memo(({ markdown }: { markdown?: string }) => {
8485

8586
const ChatRow = memo(
8687
(props: ChatRowProps) => {
87-
const { isLast, onHeightChange, message, lastModifiedMessage } = props
88+
const { isLast, onHeightChange, message, lastModifiedMessage, inputValue } = props
8889
// Store the previous height to compare with the current height
8990
// This allows us to detect changes without causing re-renders
9091
const prevHeightRef = useRef(0)
@@ -117,7 +118,14 @@ const ChatRow = memo(
117118

118119
export default ChatRow
119120

120-
export const ChatRowContent = ({ message, isExpanded, onToggleExpand, lastModifiedMessage, isLast }: ChatRowContentProps) => {
121+
export const ChatRowContent = ({
122+
message,
123+
isExpanded,
124+
onToggleExpand,
125+
lastModifiedMessage,
126+
isLast,
127+
inputValue,
128+
}: ChatRowContentProps) => {
121129
const { mcpServers, mcpMarketplaceCatalog } = useExtensionState()
122130
const [seeNewChangesDisabled, setSeeNewChangesDisabled] = useState(false)
123131

@@ -1248,6 +1256,7 @@ export const ChatRowContent = ({ message, isExpanded, onToggleExpand, lastModifi
12481256
options={options}
12491257
selected={selected}
12501258
isActive={isLast && lastModifiedMessage?.ask === "followup"}
1259+
inputValue={inputValue}
12511260
/>
12521261
</div>
12531262
</>
@@ -1287,6 +1296,7 @@ export const ChatRowContent = ({ message, isExpanded, onToggleExpand, lastModifi
12871296
options={options}
12881297
selected={selected}
12891298
isActive={isLast && lastModifiedMessage?.ask === "plan_mode_respond"}
1299+
inputValue={inputValue}
12901300
/>
12911301
</div>
12921302
)

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,10 +789,11 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
789789
lastModifiedMessage={modifiedMessages.at(-1)}
790790
isLast={index === groupedMessages.length - 1}
791791
onHeightChange={handleRowHeightChange}
792+
inputValue={inputValue}
792793
/>
793794
)
794795
},
795-
[expandedRows, modifiedMessages, groupedMessages.length, toggleRowExpansion, handleRowHeightChange],
796+
[expandedRows, modifiedMessages, groupedMessages.length, toggleRowExpansion, handleRowHeightChange, inputValue],
796797
)
797798

798799
return (

webview-ui/src/components/chat/OptionsButtons.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ export const OptionsButtons = ({
2626
options,
2727
selected,
2828
isActive,
29+
inputValue,
2930
}: {
3031
options?: string[]
3132
selected?: string
3233
isActive?: boolean
34+
inputValue?: string
3335
}) => {
3436
if (!options?.length) return null
3537

@@ -58,7 +60,7 @@ export const OptionsButtons = ({
5860
}
5961
vscode.postMessage({
6062
type: "optionsResponse",
61-
text: option,
63+
text: option + (inputValue ? `: ${inputValue?.trim()}` : ""),
6264
})
6365
}}>
6466
{option}

0 commit comments

Comments
 (0)