From 6e21704786f0c5cf44074c902f5472fc4caa7a1f Mon Sep 17 00:00:00 2001 From: Hirokazu Hata Date: Mon, 23 Mar 2020 12:06:03 +0900 Subject: if root_dir is not directry, we don't execute lsp.start_client fix: #161. If the buffer is not actual file like the special buffer for the plugin, it doesn't have root_dir and we should not execute lsp.start_client for that buffer. --- lua/nvim_lsp/configs.lua | 1 - lua/nvim_lsp/util.lua | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/nvim_lsp/configs.lua b/lua/nvim_lsp/configs.lua index 1ee1a744..e1145147 100644 --- a/lua/nvim_lsp/configs.lua +++ b/lua/nvim_lsp/configs.lua @@ -162,7 +162,6 @@ function configs.__newindex(t, config_name, config_def) function manager.try_add() local root_dir = get_root_dir(api.nvim_buf_get_name(0), api.nvim_get_current_buf()) - if not root_dir then return end local id = manager.add(root_dir) if id then lsp.buf_attach_client(0, id) diff --git a/lua/nvim_lsp/util.lua b/lua/nvim_lsp/util.lua index 33eff0c9..ab084ea4 100644 --- a/lua/nvim_lsp/util.lua +++ b/lua/nvim_lsp/util.lua @@ -231,6 +231,7 @@ function M.server_per_root_dir_manager(_make_config) function manager.add(root_dir) if not root_dir then return end + if not M.path.is_dir(root_dir) then return end -- Check if we have a client alredy or start and store it. local client_id = clients[root_dir] -- cgit v1.2.3-70-g09d2