forked from zbirenbaum/copilot.lua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
53 lines (42 loc) · 1.48 KB
/
init.lua
File metadata and controls
53 lines (42 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
local M = { setup_done = false }
local config = require("copilot.config")
local highlight = require("copilot.highlight")
local logger = require("copilot.logger")
local client = require("copilot.client")
local create_cmds = function()
vim.api.nvim_create_user_command("CopilotDetach", function()
if require("copilot.client").buf_is_attached(0) then
vim.deprecate("':CopilotDetach'", "':Copilot detach'", "in future", "copilot.lua")
vim.cmd("Copilot detach")
end
end, {})
vim.api.nvim_create_user_command("CopilotStop", function()
vim.deprecate("':CopilotStop'", "':Copilot disable'", "in future", "copilot.lua")
vim.cmd("Copilot disable")
end, {})
vim.api.nvim_create_user_command("CopilotPanel", function()
vim.deprecate("':CopilotPanel'", "':Copilot panel'", "in future", "copilot.lua")
vim.cmd("Copilot panel")
end, {})
vim.api.nvim_create_user_command("CopilotAuth", function()
vim.deprecate("':CopilotAuth'", "':Copilot auth'", "in future", "copilot.lua")
vim.cmd("Copilot auth")
end, {})
end
M.setup = function(opts)
if M.setup_done then
return
end
highlight.setup()
local conf = config.setup(opts)
if conf and conf.panel.enabled then
create_cmds()
end
require("copilot.command").enable()
logger.setup(conf.logger)
logger.debug("active plugin config:", config)
-- logged here to ensure the logger is setup
logger.debug("active LSP config (may change runtime):", client.config)
M.setup_done = true
end
return M