From d597b0f3605f43526f1b6948c6d7ca2919ea32ac Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 20 Dec 2022 14:27:21 +0800 Subject: fix: send the lsp method request after insert workspace folders (#2330) * fix: send the lsp method request after insert workspace folders * fix: use client do rpc request * fix: check client support workspace --- lua/lspconfig/util.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index b38b8ec6..fcf286d0 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -257,7 +257,13 @@ function M.server_per_root_dir_manager(make_config) return end local client = lsp.get_client_by_id(id) - if client and client.name == conf.name then + if + client + and client.server_capabilities + and client.server_capabilities.workspaceFolders + and client.server_capabilities.workspaceFolders.supported + and client.name == conf.name + then return client end return nil @@ -272,6 +278,7 @@ function M.server_per_root_dir_manager(make_config) { { uri = vim.uri_from_fname(root_dir), name = root_dir } }, { {} } ) + client.rpc.notify('workspace/didChangeWorkspaceFolders', params) if not client.workspace_folders then client.workspace_folders = {} end -- cgit v1.2.3-70-g09d2