Skip to content

Commit

Permalink
fix(lsp): check if buf is still valid after receiving document symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 30, 2024
1 parent d75011a commit 33ec71c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lua/trouble/sources/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ function M.get.document_symbols(cb)
local params = { textDocument = vim.lsp.util.make_text_document_params() }

M.request("textDocument/documentSymbol", params, function(results)
if not vim.api.nvim_buf_is_valid(buf) then
Cache.symbols[buf] = nil
return
end
---@cast results table<vim.lsp.Client,lsp.SymbolInformation[]|lsp.DocumentSymbol[]>
local items = {} ---@type trouble.Item[]

Expand Down

0 comments on commit 33ec71c

Please sign in to comment.