mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: add proper type guards for selection context fields
This commit is contained in:
parent
bb8d44d26f
commit
e25c2d66f4
1 changed files with 14 additions and 2 deletions
|
|
@ -566,7 +566,13 @@ export const webviewMessageHandler = async (
|
|||
|
||||
// Store selection context in the newly created task
|
||||
const newTask = provider.getCurrentTask()
|
||||
if (newTask && message.selectedText) {
|
||||
if (
|
||||
newTask &&
|
||||
message.selectedText &&
|
||||
message.selectionFilePath &&
|
||||
typeof message.selectionStartLine === "number" &&
|
||||
typeof message.selectionEndLine === "number"
|
||||
) {
|
||||
newTask.selectionContext = {
|
||||
selectedText: message.selectedText,
|
||||
selectionFilePath: message.selectionFilePath,
|
||||
|
|
@ -593,7 +599,13 @@ export const webviewMessageHandler = async (
|
|||
case "askResponse": {
|
||||
// Store selection context in current task before handling response
|
||||
const task = provider.getCurrentTask()
|
||||
if (task && message.selectedText) {
|
||||
if (
|
||||
task &&
|
||||
message.selectedText &&
|
||||
message.selectionFilePath &&
|
||||
typeof message.selectionStartLine === "number" &&
|
||||
typeof message.selectionEndLine === "number"
|
||||
) {
|
||||
task.selectionContext = {
|
||||
selectedText: message.selectedText,
|
||||
selectionFilePath: message.selectionFilePath,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue