diff options
| author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-11-24 18:52:08 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-24 18:52:08 -0500 |
| commit | 724598e80c79361d610f13cf95a9012b2fb42e7c (patch) | |
| tree | 7ca2c89193c145eafd6bba9753919b0cc7f8ec73 /lua/lspconfig/util.lua | |
| parent | docs: update server_configurations.md (diff) | |
| download | nvim-lspconfig-724598e80c79361d610f13cf95a9012b2fb42e7c.tar nvim-lspconfig-724598e80c79361d610f13cf95a9012b2fb42e7c.tar.gz nvim-lspconfig-724598e80c79361d610f13cf95a9012b2fb42e7c.tar.bz2 nvim-lspconfig-724598e80c79361d610f13cf95a9012b2fb42e7c.tar.lz nvim-lspconfig-724598e80c79361d610f13cf95a9012b2fb42e7c.tar.xz nvim-lspconfig-724598e80c79361d610f13cf95a9012b2fb42e7c.tar.zst nvim-lspconfig-724598e80c79361d610f13cf95a9012b2fb42e7c.zip | |
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
Diffstat (limited to 'lua/lspconfig/util.lua')
| -rw-r--r-- | lua/lspconfig/util.lua | 13 |
1 files changed, 8 insertions, 5 deletions
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 |
