Skip to content

Commit b34a78f

Browse files
committed
feat: add CCTests command
chore: briefly explain the code before adding unit tests
1 parent 199561c commit b34a78f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lua/CopilotChat/init.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ M.setup = function()
88
utils.create_cmd('CChatExplain', function(opts)
99
vim.cmd('CChat Explain how it works')
1010
end, { nargs = '*', range = true })
11+
12+
-- Add new command to generate unit tests with CopilotChat for selected text
13+
utils.create_cmd('CChatTests', function(opts)
14+
local cmd = 'CChat Briefly explain how it works then generate unit tests for the code.'
15+
-- Append the provided arguments to the command if any
16+
if opts.args then
17+
cmd = cmd .. ' ' .. opts.args
18+
end
19+
vim.cmd(cmd)
20+
end, { nargs = '*', range = true })
1121
end
1222

1323
return M

0 commit comments

Comments
 (0)