Skip to content

Commit 8d9cc34

Browse files
committed
add copilot_node_command to setup opts
1 parent ede741d commit 8d9cc34

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ panel = { -- no config options yet
7474
enabled = true,
7575
},
7676
ft_disable = {},
77+
copilot_node_command = 'node', -- Node version must be < 18
7778
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
7879
server_opts_overrides = {},
7980
```
@@ -127,6 +128,16 @@ require("copilot").setup {
127128
}
128129
```
129130

131+
##### copilot_node_command
132+
133+
Use this field to provide the path to a specific node version such as one installed by nvm. Node version must be < 18. The LTS version of node (16.17.0) is recommended.
134+
135+
Example:
136+
137+
```lua
138+
copilot_node_command = vim.fn.expand("$HOME") .. "/.config/nvm/versions/node/v16.14.2/bin/node", -- Node version must be < 18
139+
```
140+
130141
##### plugin_manager_path
131142

132143
This is installation path of Packer, change this to the plugin manager installation path of your choice

lua/copilot/client.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ end
2121

2222
M.merge_server_opts = function (params)
2323
return vim.tbl_deep_extend("force", {
24-
cmd = {'node', require("copilot.util").get_copilot_path(params.plugin_manager_path)},
24+
cmd = {
25+
params.copilot_node_command or "node",
26+
require("copilot.util").get_copilot_path(params.plugin_manager_path)
27+
},
2528
cmd_cwd = vim.fn.expand('~'),
2629
root_dir = vim.loop.cwd(),
2730
name = "copilot",

lua/copilot/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ local defaults = {
1010
enabled = true,
1111
},
1212
ft_disable = {},
13+
copilot_node_command = "node",
1314
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
1415
server_opts_overrides = {},
1516
}

0 commit comments

Comments
 (0)