Skip to content
Merged
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
16 changes: 13 additions & 3 deletions lua/codecompanion/strategies/chat/tools/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,7 @@ function Tools:run()
end
end

-- Delay executing the job to allow for output to be collated and processed
self.chat.current_tool = Job:new({
local new_job = Job:new({
command = vim.fn.has("win32") == 1 and "cmd.exe" or "sh",
args = { vim.fn.has("win32") == 1 and "/c" or "-c", table.concat(cmd.cmd or cmd, " ") },
enable_recording = true,
Expand Down Expand Up @@ -418,7 +417,18 @@ function Tools:run()
run(index + 1, data)
end)
end,
}):start()
})

if self.chat.current_tool then
-- Chain to the previous job if it exists
self.chat.current_tool:and_then_wrap(new_job)
else
-- Start first job directly
new_job:start()
end

-- Update current_tool reference
self.chat.current_tool = new_job
end
end

Expand Down