Skip to content

Commit 3bfdf96

Browse files
committed
fix(panel): do not open if not attached
1 parent 8b0fd23 commit 3bfdf96

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lua/copilot/panel.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,15 @@ function panel:init()
496496
return
497497
end
498498

499+
if not c.buf_is_attached(0) then
500+
local should_attach, no_attach_reason = util.should_attach()
501+
vim.notify(
502+
string.format("[Copilot] %s", should_attach and ("Disabled manually for " .. vim.bo.filetype) or no_attach_reason),
503+
vim.log.levels.ERROR
504+
)
505+
return
506+
end
507+
499508
self.panel_uri = panel_uri_from_doc_uri(doc.uri)
500509
self.filetype = vim.bo.filetype
501510

0 commit comments

Comments
 (0)