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({
129129
130130 return true
131131 end ,
132+ lsp_binary = nil ,
132133 server_opts_overrides = {},
133134})
134135```
@@ -343,6 +344,18 @@ require("copilot").setup {
343344}
344345```
345346
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+
346359## Commands
347360
348361` 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 = {
7575
7676 return true
7777 end ,
78+ --- @type string | nil
79+ lsp_binary = nil ,
7880}
7981
8082local mod = {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ local highlight = require("copilot.highlight")
44local logger = require (" copilot.logger" )
55local client = require (" copilot.client" )
66local auth = require (" copilot.auth" )
7+ local lsp_binary = require (" copilot.lsp_binary" )
78
89local create_cmds = function ()
910 vim .api .nvim_create_user_command (" CopilotDetach" , function ()
@@ -41,6 +42,7 @@ M.setup = function(opts)
4142 create_cmds ()
4243 end
4344
45+ lsp_binary .setup (conf .lsp_binary )
4446 require (" copilot.command" ).enable ()
4547 logger .setup (conf .logger )
4648
Original file line number Diff line number Diff line change @@ -265,4 +265,27 @@ function M.get_copilot_server_info()
265265 return M .copilot_server_info
266266end
267267
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+
268291return M
You can’t perform that action at this time.
0 commit comments