File tree Expand file tree Collapse file tree 4 files changed +40
-0
lines changed Expand file tree Collapse file tree 4 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ require('copilot').setup({
129
129
130
130
return true
131
131
end ,
132
+ lsp_binary = nil ,
132
133
server_opts_overrides = {},
133
134
})
134
135
```
@@ -343,6 +344,18 @@ require("copilot").setup {
343
344
}
344
345
```
345
346
347
+ ### lsp_binary
348
+
349
+ This allows you to specify the path to the copilot lsp binary.
350
+ This will disable the download of the binary and use the one specified.
351
+ example:
352
+
353
+ ``` lua
354
+ require (" copilot" ).setup {
355
+ lsp_binary = " /home/user/.local/bin/copilot-language-server" ,
356
+ }
357
+ ```
358
+
346
359
## Commands
347
360
348
361
` copilot.lua ` defines the ` :Copilot ` command that can perform various actions. It has completion support, so try it out.
Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ local default_config = {
75
75
76
76
return true
77
77
end ,
78
+ --- @type string | nil
79
+ lsp_binary = nil ,
78
80
}
79
81
80
82
local mod = {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ local highlight = require("copilot.highlight")
4
4
local logger = require (" copilot.logger" )
5
5
local client = require (" copilot.client" )
6
6
local auth = require (" copilot.auth" )
7
+ local lsp_binary = require (" copilot.lsp_binary" )
7
8
8
9
local create_cmds = function ()
9
10
vim .api .nvim_create_user_command (" CopilotDetach" , function ()
@@ -41,6 +42,7 @@ M.setup = function(opts)
41
42
create_cmds ()
42
43
end
43
44
45
+ lsp_binary .setup (conf .lsp_binary )
44
46
require (" copilot.command" ).enable ()
45
47
logger .setup (conf .logger )
46
48
Original file line number Diff line number Diff line change @@ -265,4 +265,27 @@ function M.get_copilot_server_info()
265
265
return M .copilot_server_info
266
266
end
267
267
268
+ function M .setup (filepath )
269
+ if not filepath then
270
+ return M
271
+ end
272
+
273
+ if not vim .fn .filereadable (filepath ) then
274
+ logger .error (" copilot-language-server not found at " .. filepath )
275
+ return M
276
+ end
277
+
278
+ M .copilot_server_info = {
279
+ path = " " ,
280
+ filename = " " ,
281
+ absolute_path = " " ,
282
+ absolute_filepath = vim .fs .normalize (filepath ),
283
+ extracted_filename = " " ,
284
+ }
285
+
286
+ logger .debug (" using custom copilot-language-server binary:" , M .copilot_server_info .absolute_filepath )
287
+
288
+ M .initialized = true
289
+ end
290
+
268
291
return M
You can’t perform that action at this time.
0 commit comments