1
1
local util = require (' lsp-status/util' )
2
2
3
+ local clients = {}
3
4
local messages = {}
4
5
local function init (_messages , _ )
5
6
messages = _messages
@@ -21,9 +22,17 @@ local function progress_callback(_, _, msg, client_id)
21
22
messages [client_id ].progress [msg .token ].percentage = val .percentage
22
23
messages [client_id ].progress [msg .token ].spinner = messages [client_id ].progress [msg .token ].spinner + 1
23
24
elseif val .kind == ' end' then
24
- messages [client_id ].progress [msg .token ].message = val .message
25
- messages [client_id ].progress [msg .token ].done = true
26
- messages [client_id ].progress [msg .token ].spinner = nil
25
+ if messages [client_id ].progress [msg .token ] == nil then
26
+ vim .api .nvim_command (' echohl WarningMsg' )
27
+ vim .api .nvim_command (
28
+ ' echom "[lsp-status] Received `end` message with no corresponding `begin` from ' .. clients [client_id ] .. ' !"'
29
+ )
30
+ vim .api .nvim_command (' echohl None' )
31
+ else
32
+ messages [client_id ].progress [msg .token ].message = val .message
33
+ messages [client_id ].progress [msg .token ].done = true
34
+ messages [client_id ].progress [msg .token ].spinner = nil
35
+ end
27
36
end
28
37
else
29
38
table.insert (messages [client_id ], { content = val , show_once = true , shown = 0 })
92
101
-- Client registration for messages
93
102
local function register_client (id , name )
94
103
util .ensure_init (messages , id , name )
104
+ clients [id ] = name
95
105
end
96
106
97
107
local capabilities = vim .lsp .protocol .make_client_capabilities ()
0 commit comments