Skip to content

Commit 04a618d

Browse files
committed
fix config handling
1 parent f18242f commit 04a618d

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed

lua/copilot/config.lua

Lines changed: 0 additions & 22 deletions
This file was deleted.

lua/copilot/init.lua

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
local config = require("copilot.config")
21
local M = {}
32

4-
M.setup = function(params)
5-
config.setup(params)
6-
config.params.plugin_manager_path = vim.fn.expand(config.params.plugin_manager_path) -- resolve wildcard and variable containing paths
7-
require("copilot.copilot_handler").start(config.params)
3+
local defaults = {
4+
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
5+
on_attach = function()
6+
require("copilot_cmp")._on_insert_enter()
7+
end,
8+
}
9+
10+
local config_handler = function(opts)
11+
local user_config = opts and vim.tbl_deep_extend("force", defaults, opts) or defaults
12+
return user_config
13+
end
14+
15+
M.setup = function(opts)
16+
local user_config = config_handler(opts)
17+
require("copilot.copilot_handler").start(user_config)
818
end
919

1020
return M

0 commit comments

Comments
 (0)