File tree Expand file tree Collapse file tree 3 files changed +30
-20
lines changed Expand file tree Collapse file tree 3 files changed +30
-20
lines changed Original file line number Diff line number Diff line change @@ -230,6 +230,11 @@ local function prepare_client_config(overrides)
230
230
}
231
231
end
232
232
233
+ if not cmd then
234
+ logger .error (" copilot server type not supported" )
235
+ return
236
+ end
237
+
233
238
local capabilities = vim .lsp .protocol .make_client_capabilities () --[[ @as copilot_capabilities]]
234
239
capabilities .window .showDocument .support = true
235
240
@@ -348,8 +353,15 @@ function M.setup()
348
353
local server_config = config .get (" server" ) --[[ @as copilot_config_server]]
349
354
local node_command = config .get (" copilot_node_command" ) --[[ @as string|nil]]
350
355
M .server = vim .tbl_deep_extend (" force" , M .server , server_config )
356
+
357
+ if M .server .custom_server_filepath then
358
+ M .server .custom_server_filepath = vim .fs .normalize (M .server .custom_server_filepath )
359
+ end
360
+
351
361
if M .server .type == " nodejs" then
352
362
lsp_nodesj .setup (node_command , M .server .custom_server_filepath )
363
+ elseif M .server .type == " binary" then
364
+ lsp_binary .setup (M .server .custom_server_filepath )
353
365
end
354
366
355
367
M .config = prepare_client_config (config .get (" server_opts_overrides" ))
Original file line number Diff line number Diff line change @@ -42,7 +42,6 @@ M.setup = function(opts)
42
42
create_cmds ()
43
43
end
44
44
45
- lsp_binary .setup (conf .lsp_binary )
46
45
require (" copilot.command" ).enable ()
47
46
logger .setup (conf .logger )
48
47
Original file line number Diff line number Diff line change @@ -326,28 +326,27 @@ function M.get_server_path()
326
326
return M .get_copilot_server_info ().absolute_filepath
327
327
end
328
328
329
- --- @param filepath string | nil
330
- function M .setup (filepath )
331
- if not filepath then
332
- return M
333
- end
329
+ --- @param custom_server_path ? string
330
+ function M .setup (custom_server_path )
331
+ if custom_server_path then
332
+ if not vim .fn .filereadable (custom_server_path ) then
333
+ logger .error (" copilot-language-server not found at " .. custom_server_path )
334
+ return M
335
+ end
334
336
335
- if not vim .fn .filereadable (filepath ) then
336
- logger .error (" copilot-language-server not found at " .. filepath )
337
- return M
338
- end
337
+ logger .debug (" using custom copilot-language-server binary:" , custom_server_path )
338
+ M .copilot_server_info = {
339
+ path = " " ,
340
+ filename = " " ,
341
+ absolute_path = " " ,
342
+ absolute_filepath = custom_server_path or " " ,
343
+ extracted_filename = " " ,
344
+ }
339
345
340
- M .copilot_server_info = {
341
- path = " " ,
342
- filename = " " ,
343
- absolute_path = " " ,
344
- absolute_filepath = vim .fs .normalize (filepath ),
345
- extracted_filename = " " ,
346
- }
347
-
348
- logger .debug (" using custom copilot-language-server binary:" , M .copilot_server_info .absolute_filepath )
346
+ M .initialized = true
347
+ end
349
348
350
- M .initialized = true
349
+ M .ensure_client_is_downloaded ()
351
350
end
352
351
353
352
return M
You can’t perform that action at this time.
0 commit comments