Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ require('copilot').setup({
["."] = false,
},
copilot_node_command = 'node', -- Node version must be < 18
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
server_opts_overrides = {},
})
```
Expand Down Expand Up @@ -201,18 +200,6 @@ Example:
copilot_node_command = vim.fn.expand("$HOME") .. "/.config/nvm/versions/node/v16.14.2/bin/node", -- Node version must be < 18
```

### 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](./SettingsOpts.md).
Expand Down
2 changes: 1 addition & 1 deletion lua/copilot/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ M.merge_server_opts = function(params)
return vim.tbl_deep_extend("force", {
cmd = {
params.copilot_node_command,
require("copilot.util").get_copilot_path(params.plugin_manager_path),
require("copilot.util").get_copilot_path(),
},
cmd_cwd = vim.fn.expand("~"),
root_dir = vim.loop.cwd(),
Expand Down
1 change: 0 additions & 1 deletion lua/copilot/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ local defaults = {
ft_disable = nil,
filetypes = {},
copilot_node_command = "node",
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
server_opts_overrides = {},
}

Expand Down
12 changes: 6 additions & 6 deletions lua/copilot/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,12 @@ function M.get_editor_configuration()
}
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
M.get_copilot_path = function()
local copilot_path = vim.api.nvim_get_runtime_file('copilot/index.js', false)[1]
if vim.fn.filereadable(copilot_path) ~= 0 then
return copilot_path
else
print("[Copilot] could not read" .. copilot_path)
end
end

Expand Down