mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
perf(lsp): remove grouping logic from lsp.status (#24096)
With the title carry-over logic in the `$/progress` handler it's not necessary to group again in vim.lsp.status
This commit is contained in:
parent
a41883bfbe
commit
4d3a04279d
@ -902,18 +902,13 @@ end
|
||||
---@return string
|
||||
function lsp.status()
|
||||
local percentage = nil
|
||||
local groups = {}
|
||||
local messages = {}
|
||||
for _, client in ipairs(vim.lsp.get_active_clients()) do
|
||||
for progress in client.progress do
|
||||
local value = progress.value
|
||||
if type(value) == 'table' and value.kind then
|
||||
local group = groups[progress.token]
|
||||
if not group then
|
||||
group = {}
|
||||
groups[progress.token] = group
|
||||
end
|
||||
group.title = value.title or group.title
|
||||
group.message = value.message or group.message
|
||||
local message = value.message and (value.title .. ': ' .. value.message) or value.title
|
||||
messages[#messages + 1] = message
|
||||
if value.percentage then
|
||||
percentage = math.max(percentage or 0, value.percentage)
|
||||
end
|
||||
@ -922,17 +917,6 @@ function lsp.status()
|
||||
-- Just ignore it as there is no sensible way to display it
|
||||
end
|
||||
end
|
||||
local messages = {}
|
||||
for _, group in pairs(groups) do
|
||||
if group.title then
|
||||
table.insert(
|
||||
messages,
|
||||
group.message and (group.title .. ': ' .. group.message) or group.title
|
||||
)
|
||||
elseif group.message then
|
||||
table.insert(messages, group.message)
|
||||
end
|
||||
end
|
||||
local message = table.concat(messages, ', ')
|
||||
if percentage then
|
||||
return string.format('%3d%%: %s', percentage, message)
|
||||
|
Loading…
Reference in New Issue
Block a user