Skip to content

Commit bb77143

Browse files
committed
fix: ensure the LSP cmd works for binaries
1 parent f4b6a6d commit bb77143

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

lua/copilot/client.lua

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,18 +211,25 @@ local function prepare_client_config(overrides)
211211
M.startup_error = nil
212212

213213
local server_path = nil
214-
local node_cmd = ""
215-
if M.server.type == "nodejs" then
216-
node_cmd = lsp_nodesj.node_command
217-
server_path = lsp_nodesj.get_server_path()
218-
elseif M.server.type == "binary" then
219-
server_path = lsp_binary.get_server_path()
220-
end
214+
local cmd = nil
221215

222216
if M.server.custom_server_filepath and vim.fn.filereadable(M.server.custom_server_filepath) then
223217
server_path = M.server.custom_server_filepath
224218
end
225219

220+
if M.server.type == "nodejs" then
221+
cmd = {
222+
lsp_nodesj.node_command,
223+
server_path or lsp_nodesj.get_server_path(),
224+
"--stdio",
225+
}
226+
elseif M.server.type == "binary" then
227+
cmd = {
228+
server_path or lsp_binary.get_server_path(),
229+
"--stdio",
230+
}
231+
end
232+
226233
local capabilities = vim.lsp.protocol.make_client_capabilities() --[[@as copilot_capabilities]]
227234
capabilities.window.showDocument.support = true
228235

@@ -285,11 +292,7 @@ local function prepare_client_config(overrides)
285292

286293
-- LSP config, not to be confused with config.lua
287294
return vim.tbl_deep_extend("force", {
288-
cmd = {
289-
node_cmd,
290-
server_path,
291-
"--stdio",
292-
},
295+
cmd = cmd,
293296
root_dir = root_dir,
294297
name = "copilot",
295298
capabilities = capabilities,

0 commit comments

Comments
 (0)