From b694a3ddc2f87e8bbfa63a8f0824061b9ba84469 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 25 Jul 2021 02:49:16 -0400 Subject: better logic for null-ls --- lua/lsp/null-ls.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lua/lsp') diff --git a/lua/lsp/null-ls.lua b/lua/lsp/null-ls.lua index 099a6dc1..b425d112 100644 --- a/lua/lsp/null-ls.lua +++ b/lua/lsp/null-ls.lua @@ -34,12 +34,18 @@ local function setup_ls(exe, type) if has_value(local_executables, exe) then local smart_executable = null_ls.builtins[type][exe] local local_executable = find_local_exe(exe) - if vim.fn.executable(local_executable) then + if vim.fn.executable(local_executable) == 1 then smart_executable._opts.command = local_executable + table.insert(sources, smart_executable) + else + if vim.fn.executable(exe) == 1 then + table.insert(sources, smart_executable) + end end - table.insert(sources, smart_executable) else - table.insert(sources, null_ls.builtins[type][exe]) + if vim.fn.executable(exe) == 1 then + table.insert(sources, null_ls.builtins[type][exe]) + end end null_ls.register { sources = sources } end -- cgit v1.2.3