Skip to content

Commit d1f499e

Browse files
committed
fix bug with using ipairs; clear stale info
1 parent eb46d19 commit d1f499e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lua/lsp-status.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ end
8181
local function on_attach(client)
8282
-- Register the client for messages
8383
messaging.register_client(client.id, client.name)
84+
print("on_attach called")
8485
vim.api.nvim_command('augroup lsp_aucmds')
8586
vim.api.nvim_command('au! * <buffer>')
8687
vim.api.nvim_command('au User DiagnosticChanged lua require("lsp-status/redraw").redraw()')

lua/lsp-status/current_function.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ end
5959

6060
local function first_capable_client(bufnr, capability)
6161
local clients = vim.lsp.buf_get_clients(bufnr)
62-
for _, client in ipairs(clients) do
62+
for _, client in pairs(clients) do
6363
if client.resolved_capabilities[capability] then
6464
return client
6565
end
@@ -71,6 +71,10 @@ local function update_current_function()
7171
if client then
7272
local params = { textDocument = lsp_util.make_text_document_params() }
7373
client.request('textDocument/documentSymbol', params, util.mk_handler(current_function_callback), 0)
74+
else
75+
-- clear current function so we don't show stale information
76+
vim.b.lsp_current_function = ''
77+
redraw.redraw()
7478
end
7579
end
7680

0 commit comments

Comments
 (0)