forked from folke/copilot.lua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
39 lines (33 loc) · 1018 Bytes
/
init.lua
File metadata and controls
39 lines (33 loc) · 1018 Bytes
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
local M = { client_info = nil }
local client = require("copilot.client")
local util = require("copilot.util")
local lsp = vim.lsp
local defaults = {
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
server_opts_overrides = {},
ft_disable = {},
cmp_method = "getCompletionsCycling"
}
local config_handler = function(opts)
local user_config = opts and vim.tbl_deep_extend("force", defaults, opts) or defaults
return user_config
end
local set_client_info = function(client_id)
M.client_info = {
client_id = client_id,
client = lsp.get_client_by_id(client_id)
}
end
local get_client_info = function ()
return M.client_info
end
M.setup = function(opts)
local user_config = config_handler(opts)
vim.schedule(function () client.start(user_config) end)
if user_config.cmp_method == "getPanelCompletions" then
require("copilot.api").panel.create()
elseif user_config.cmp_method == "getCompletionsCycling" then
require("copilot_cmp").setup()
end
end
return M