diff --git a/README.md b/README.md index cf18c739..a7ab4f68 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,6 @@ panel = { -- no config options yet enabled = true, }, ft_disable = {}, -plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer", server_opts_overrides = {}, ``` @@ -116,18 +115,6 @@ require("copilot").setup { } ``` -##### plugin_manager_path - -This is installation path of Packer, change this to the plugin manager installation path of your choice - -Example: - -```lua -require("copilot").setup { - plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer", -} -``` - ##### server_opts_overrides Override copilot lsp client settings. The `settings` field is where you can set the values of the options defined in SettingsOpts.md. These options are specific to the copilot lsp and can be used to customize its behavior. Ensure that the name field is not overriden as is is used for efficiency reasons in numerous checks to verify copilot is actually running. See `:h vim.lsp.start_client` for list of options. diff --git a/lua/copilot/client.lua b/lua/copilot/client.lua index eb254397..998cd798 100644 --- a/lua/copilot/client.lua +++ b/lua/copilot/client.lua @@ -19,7 +19,7 @@ end M.merge_server_opts = function (params) return vim.tbl_deep_extend("force", { - cmd = { "node", require("copilot.util").get_copilot_path(params.plugin_manager_path) }, + cmd = { "node", require("copilot.util").get_copilot_path() }, name = "copilot", root_dir = vim.loop.cwd(), autostart = true, diff --git a/lua/copilot/init.lua b/lua/copilot/init.lua index 02daf0f5..ca2a9125 100644 --- a/lua/copilot/init.lua +++ b/lua/copilot/init.lua @@ -10,7 +10,6 @@ local defaults = { enabled = true, }, ft_disable = {}, - plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer", server_opts_overrides = {}, } diff --git a/lua/copilot/util.lua b/lua/copilot/util.lua index 95e176cb..7c468f40 100644 --- a/lua/copilot/util.lua +++ b/lua/copilot/util.lua @@ -39,14 +39,9 @@ M.get_completion_params = function() return params end -M.get_copilot_path = function(plugin_path) - for _, loc in ipairs({ "/opt", "/start", "" }) do - local copilot_path = plugin_path .. loc .. "/copilot.lua/copilot/index.js" - if vim.fn.filereadable(copilot_path) ~= 0 then - return copilot_path - end - end +M.get_copilot_path = function() + local plugin_path = vim.api.nvim_exec("echo expand(':p:h:h:h')", true) + return plugin_path .. "/copilot/index.js" end - return M