From 80b632ee959f10eb3d39487fd84382e46fecb8dc Mon Sep 17 00:00:00 2001 From: ashincoder <83629316+ashincoder@users.noreply.github.com> Date: Thu, 26 Aug 2021 13:22:48 +0530 Subject: [PATCH] feat: Added lsp radial progress --- lua/plugins/configs/statusline.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lua/plugins/configs/statusline.lua b/lua/plugins/configs/statusline.lua index 43d9d73..5f927e0 100644 --- a/lua/plugins/configs/statusline.lua +++ b/lua/plugins/configs/statusline.lua @@ -173,6 +173,34 @@ components.left.active[11] = { icon = "  ", } +components.mid.active[1] = { + provider = function() + local Lsp = vim.lsp.util.get_progress_messages()[1] + if Lsp then + local msg = Lsp.message or "" + local percentage = Lsp.percentage or 0 + local title = Lsp.title or "" + local spinners = { + "󰝦", + "󰪞", + "󰪟", + "󰪠", + "󰪡", + "󰪢", + "󰪣", + "󰪤", + "󰪥", + } + + local ms = vim.loop.hrtime() / 1000000 + local frame = math.floor(ms / 120) % #spinners + return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage) + end + return "" + end, + hl = { fg = colors.green }, +} + components.right.active[1] = { provider = function() if next(vim.lsp.buf_get_clients()) ~= nil then