diff options
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
| -rw-r--r-- | runtime/lua/vim/lsp/handlers.lua | 16 | 
1 files changed, 14 insertions, 2 deletions
| diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index c0843e1577..a997b887d9 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -152,6 +152,17 @@ M['workspace/configuration'] = function(_, result, ctx)    return response  end +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_workspaceFolders +M['workspace/workspaceFolders'] = function(_, _, ctx) +  local client_id = ctx.client_id +  local client = vim.lsp.get_client_by_id(client_id) +  if not client then +    err_message("LSP[id=", client_id, "] client has shut down after sending the message") +    return +  end +  return client.workspace_folders or vim.NIL +end +  M['textDocument/publishDiagnostics'] = function(...)    return require('vim.lsp.diagnostic').on_publish_diagnostics(...)  end @@ -166,18 +177,19 @@ M['textDocument/references'] = function(_, result, ctx, config)    if not result or vim.tbl_isempty(result) then      vim.notify('No references found')    else +    local client = vim.lsp.get_client_by_id(ctx.client_id)      config = config or {}      if config.loclist then        vim.fn.setloclist(0, {}, ' ', {          title = 'References'; -        items = util.locations_to_items(result, ctx.offset_encoding); +        items = util.locations_to_items(result, client.offset_encoding);          context = ctx;        })        api.nvim_command("lopen")      else        vim.fn.setqflist({}, ' ', {          title = 'References'; -        items = util.locations_to_items(result, ctx.offset_encoding); +        items = util.locations_to_items(result, client.offset_encoding);          context = ctx;        })        api.nvim_command("botright copen") | 
