Skip to content

Commit

Permalink
fix: LSP synchronous symbol fetch when buffer has multiple clients (#215
Browse files Browse the repository at this point in the history
)
  • Loading branch information
stevearc committed Feb 4, 2023
1 parent eec09f1 commit 7f09d0d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lua/aerial/backends/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ M.fetch_symbols_sync = function(bufnr, opts)
timeout = 4000,
})
local params = { textDocument = vim.lsp.util.make_text_document_params(bufnr) }
local lsp_results, err =
local response_map, err =
vim.lsp.buf_request_sync(bufnr, "textDocument/documentSymbol", params, opts.timeout)
if err then
vim.api.nvim_err_writeln("Error when finding document symbols: " .. err)
if err or vim.tbl_isempty(response_map) then
vim.notify(string.format("Error fetching document symbols: %s", err), vim.log.levels.ERROR)
else
callbacks.handle_symbols(lsp_results[1].result, bufnr)
local _, response = next(response_map)
callbacks.handle_symbols(response.result, bufnr)
end
end

Expand Down

0 comments on commit 7f09d0d

Please sign in to comment.