Skip to content

Commit ce69731

Browse files
tetoMcPatate
andauthored
feat(config): accept to run llm-ls in PATH (#116)
* feat(config): accept to run llm-ls in PATH It's uncommon to completely ignore PATH. I have llm-ls installed via my package manager, and the downloaded one wouldn't work anyway. If bin_path is not set, llm.nvim will try to start llm-ls from PATH, else fallback to config.lsp.bin_path. Note that we dont check The 'version' of llm-ls so it's possible for the plugin to run a version that doesn't match the one configured (for instance if you've added it after the first run of llm.nvim). A version check could/should be added later. --------- Co-authored-by: Luc Georges <[email protected]>
1 parent 9832a14 commit ce69731

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lua/llm/language_server.lua

+5-5
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ local function download_and_unzip(url, path)
7575
end
7676

7777
local function download_llm_ls()
78-
local bin_path = config.get().lsp.bin_path
79-
if bin_path ~= nil and fn.filereadable(bin_path) == 1 then
80-
return bin_path
81-
end
8278
local bin_dir = vim.api.nvim_call_function("stdpath", { "data" }) .. "/llm_nvim/bin"
8379
fn.system("mkdir -p " .. bin_dir)
8480
local bin_name = build_binary_name()
@@ -187,19 +183,23 @@ function M.setup()
187183

188184
local cmd
189185
local host = config.get().lsp.host
186+
local bin_path = config.get().lsp.bin_path or "llm-ls"
187+
190188
if host == "localhost" then
191189
host = "127.0.0.1"
192190
end
193191
local port = config.get().lsp.port
194192
if host ~= nil and port ~= nil then
195193
cmd = lsp.rpc.connect(host, port)
196-
else
194+
elseif fn.executable(bin_path) == 0 then
197195
local llm_ls_path = download_llm_ls()
198196
if llm_ls_path == nil then
199197
vim.notify("[LLM] failed to download llm-ls", vim.log.levels.ERROR)
200198
return
201199
end
202200
cmd = { llm_ls_path }
201+
else
202+
cmd = { bin_path }
203203
end
204204

205205
local client_id = lsp.start_client({

0 commit comments

Comments
 (0)