Skip to content

Commit 44ee0e7

Browse files
committed
Fix: statusline state needs to be global to ensure that all buffers display current messages, etc.
There was a bug where switching to a new buffer would not display the statusline component until more messages were received, which may never happen
1 parent 3fd06d6 commit 44ee0e7

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

lua/lsp-status/current_function.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ local function current_function_callback(_, _, result, _, _)
2121
end)
2222

2323
if not function_symbols or #function_symbols == 0 then
24-
vim.b.lsp_status_redraw = true
24+
vim.g.lsp_status_redraw = true
2525
return
2626
end
2727

@@ -38,7 +38,7 @@ local function current_function_callback(_, _, result, _, _)
3838
end
3939

4040
vim.b.lsp_current_function = fn_name
41-
vim.b.lsp_status_redraw = true
41+
vim.g.lsp_status_redraw = true
4242
return
4343
end
4444
end

lua/lsp-status/extensions/clangd.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ local handlers = {
1616
['textDocument/clangd.fileStatus'] = function(_, _, statusMessage, client_id)
1717
ensure_init(client_id)
1818
messages[client_id].status = { uri = statusMessage.uri, content = statusMessage.state }
19-
vim.b.lsp_status_redraw = true
2019
end,
20+
vim.g.lsp_status_redraw = true
2121
}
2222

2323
--- Return the handler {LSP Method: handler} table for `clangd`'s `fileStatus` extension

lua/lsp-status/extensions/pyls_ms.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ local handlers = {
1616
['python/setStatusBarMessage'] = function(_, _, message, client_id)
1717
ensure_init(client_id)
1818
messages[client_id].static_message = { content = message[1] }
19-
vim.b.lsp_status_redraw = true
19+
vim.g.lsp_status_redraw = true
2020
end,
2121
['python/beginProgress'] = function(_, _, _, client_id)
2222
ensure_init(client_id)
@@ -27,12 +27,12 @@ local handlers = {
2727
['python/reportProgress'] = function(_, _, message, client_id)
2828
messages[client_id].progress[1].spinner = messages[client_id].progress[1].spinner + 1
2929
messages[client_id].progress[1].title = message[1]
30-
vim.b.lsp_status_redraw = true
30+
vim.g.lsp_status_redraw = true
3131
end,
3232
['python/endProgress'] = function(_, _, _, client_id)
3333
messages[client_id].progress[1] = nil
34-
vim.b.lsp_status_redraw = true
3534
end,
35+
vim.g.lsp_status_redraw = true
3636
}
3737

3838
--- Return the handler {LSP Method: handler} table for `MPLS`'s progress and statusbar message

lua/lsp-status/messaging.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ local function progress_callback(_, _, msg, client_id)
4343
table.insert(messages[client_id], {content = val, show_once = true, shown = 0})
4444
end
4545

46-
vim.b.lsp_status_redraw = true
46+
vim.g.lsp_status_redraw = true
4747
end
4848

4949
-- Process messages

0 commit comments

Comments
 (0)