Skip to content

Commit 865f40f

Browse files
committed
feat: add ability to toggle the panel
1 parent e1e761b commit 865f40f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ require("copilot.panel").accept()
119119
require("copilot.panel").jump_next()
120120
require("copilot.panel").jump_prev()
121121
require("copilot.panel").open({position, ratio})
122+
require("copilot.panel").toggle()
122123
require("copilot.panel").refresh()
123124
```
124125

lua/copilot/panel.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,14 @@ function mod.jump_next()
534534
panel:jump(1)
535535
end
536536

537+
function mod.toggle()
538+
if panel.winid and vim.api.nvim_win_is_valid(panel.winid) then
539+
panel:close()
540+
else
541+
mod.open({})
542+
end
543+
end
544+
537545
function mod.refresh()
538546
vim.api.nvim_buf_call(vim.uri_to_bufnr(panel_uri_to_doc_uri(panel.panel_uri)), function()
539547
panel:refresh()

0 commit comments

Comments
 (0)