From 724598e80c79361d610f13cf95a9012b2fb42e7c Mon Sep 17 00:00:00 2001 From: Michael Lingelbach Date: Wed, 24 Nov 2021 18:52:08 -0500 Subject: chore: remove executable check (#1477) * start_client handles checking if the server is executable, it is redundant to check this in lspconfig * vim.fn.executable does not respect cmd_env, which can allow injecting servers via a local PATH override --- lua/lspconfig/util.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lua') diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index 6f334ae3..aaba4db2 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -258,16 +258,13 @@ function M.server_per_root_dir_manager(_make_config) return end if not new_config.cmd then - print( + vim.notify( string.format( - 'Error: cmd not defined for %q. You must manually set cmd in the setup{} call according to server_configurations.md, see :help lspconfig-index.', + 'Error: cmd not defined for %q. Manually set cmd in the setup {} call according to server_configurations.md, see :help lspconfig-index.', new_config.name ) ) return - elseif vim.fn.executable(new_config.cmd[1]) == 0 then - vim.notify(string.format('cmd [%q] is not executable.', new_config.cmd[1]), vim.log.levels.Error) - return end new_config.on_exit = M.add_hook_before(new_config.on_exit, function() clients[root_dir] = nil @@ -285,6 +282,12 @@ function M.server_per_root_dir_manager(_make_config) new_config.workspace_folders = nil end client_id = lsp.start_client(new_config) + + -- Handle failures in start_client + if not client_id then + return + end + if single_file_mode then single_file_clients[root_dir] = client_id else -- cgit v1.2.3-70-g09d2