pojokcodeid.nvim-lazy/lua/plugins/lspprogress.lua

83 lines
1.8 KiB
Lua
Raw Normal View History

local function ambilKataDariKiri(kalimat, jumlahKata)
local hasil = ""
local posisiAwal = 1
local kataKe = 0
while kataKe < jumlahKata do
local posisiSpasi = string.find(kalimat, " ", posisiAwal)
if posisiSpasi then
hasil = hasil .. string.sub(kalimat, posisiAwal, posisiSpasi - 1) .. " "
posisiAwal = posisiSpasi + 1
else
hasil = hasil .. string.sub(kalimat, posisiAwal)
break
end
kataKe = kataKe + 1
end
return hasil
end
2023-03-03 19:15:17 +07:00
local fidget = true
local lualine = false
local data_exists, custom_ui = pcall(require, "core.config")
2023-03-03 19:15:17 +07:00
if data_exists then
if type(custom_ui) == "table" then
if custom_ui.progress == 1 then
fidget = false
lualine = true
elseif custom_ui.progress == 2 then
fidget = true
lualine = false
elseif custom_ui.progress == 0 then
fidget = false
lualine = false
else
fidget = true
lualine = false
end
end
else
fidget = true
lualine = false
end
return {
{
"j-hui/fidget.nvim",
2024-03-09 08:06:10 +07:00
lazy = true,
2023-03-03 19:15:17 +07:00
enabled = fidget,
2023-06-12 07:11:47 +07:00
tag = "legacy",
2023-03-03 19:15:17 +07:00
event = "BufRead",
config = function()
2024-02-21 17:19:44 +07:00
require("fidget").setup({
window = {
blend = 0,
relative = "editor",
},
})
2023-03-03 19:15:17 +07:00
end,
},
{
"linrongbin16/lsp-progress.nvim",
enabled = lualine,
2024-03-09 08:06:10 +07:00
lazy = true,
2023-03-03 19:15:17 +07:00
branch = "main",
event = { "BufRead" },
config = function()
require("lsp-progress").setup({
2023-03-03 21:44:37 +07:00
client_format = function(client_name, spinner, series_messages)
2024-03-02 18:32:21 +07:00
return #series_messages > 0
and (spinner .. " " .. ambilKataDariKiri(table.concat(series_messages, ", "), 4) .. "...")
2024-03-02 18:32:21 +07:00
or nil
2023-03-03 21:44:37 +07:00
end,
2023-03-03 19:15:17 +07:00
format = function(client_messages)
2023-03-03 21:44:37 +07:00
local sign = ""
2024-03-02 18:32:21 +07:00
return #client_messages > 0
and (sign .. " " .. ambilKataDariKiri(table.concat(client_messages, " "), 4) .. "...")
2024-03-02 18:32:21 +07:00
or sign
2023-03-03 19:15:17 +07:00
end,
})
end,
},
}