feat: add lsp-progress.nvim

also removes unused yazi dependency
This commit is contained in:
Youwen Wu 2024-09-17 00:42:18 -07:00
parent 414e46dd15
commit 2758fd1022
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
4 changed files with 94 additions and 29 deletions

View file

@ -3,7 +3,6 @@
{ {
extraPackages = with pkgs; [ extraPackages = with pkgs; [
ripgrep ripgrep
yazi
fd fd
]; ];
@ -25,34 +24,24 @@
barbecue.enable = true; barbecue.enable = true;
lualine = { lualine = {
enable = true; enable = true;
settings = {
sections = { sections = {
lualine_a = [ "branch" ]; lualine_a = [ "branch" ];
lualine_b = [ "diff" ]; lualine_b = [ "diff" ];
lualine_c = [ lualine_c = [
# { {
# __unkeyed-1 = { __unkeyed-1 = {
# __raw = '' __raw = ''
# function() function()
# local bufnr = vim.api.nvim_get_current_buf() return require('lsp-progress').progress()
# end,
# local clients = vim.lsp.buf_get_clients(bufnr) '';
# if next(clients) == nil then };
# return "" }
# end
#
# local c = {}
# for _, client in pairs(clients) do
# table.insert(c, client.name)
# end
# return '\u{f085} ' .. table.concat(c, '|')
# end
# '';
# icon = "";
# };
# }
]; ];
}; };
globalstatus = true; options.globalstatus = true;
};
}; };
crates-nvim.enable = true; crates-nvim.enable = true;
# git stuff # git stuff
@ -71,5 +60,9 @@
name = "render-markdown.nvim"; name = "render-markdown.nvim";
src = inputs.render-markdown; src = inputs.render-markdown;
}) })
(pkgs.vimUtils.buildVimPlugin {
name = "lsp-progress.nvim";
src = inputs.lsp-progress;
})
]; ];
} }

View file

@ -3,6 +3,57 @@
extraConfigLua = '' extraConfigLua = ''
require("telescope").load_extension("yank_history") require("telescope").load_extension("yank_history")
require("telescope").load_extension("ht") require("telescope").load_extension("ht")
vim.diagnostic.config({ virtual_lines = false }); vim.diagnostic.config({ virtual_lines = false })
require("lsp-progress").setup({
client_format = function(client_name, spinner, series_messages)
if #series_messages == 0 then
return nil
end
return {
name = client_name,
body = spinner .. " " .. table.concat(series_messages, ", "),
}
end,
format = function(client_messages)
--- @param name string
--- @param msg string?
--- @return string
local function stringify(name, msg)
return msg and string.format("%s %s", name, msg) or name
end
local sign = "" -- nf-fa-gear \uf013
local lsp_clients = vim.lsp.get_active_clients()
local messages_map = {}
for _, climsg in ipairs(client_messages) do
messages_map[climsg.name] = climsg.body
end
if #lsp_clients > 0 then
table.sort(lsp_clients, function(a, b)
return a.name < b.name
end)
local builder = {}
for _, cli in ipairs(lsp_clients) do
if
type(cli) == "table"
and type(cli.name) == "string"
and string.len(cli.name) > 0
then
if messages_map[cli.name] then
table.insert(builder, stringify(cli.name, messages_map[cli.name]))
else
table.insert(builder, stringify(cli.name))
end
end
end
if #builder > 0 then
return sign .. " " .. table.concat(builder, ", ")
end
end
return ""
end,
})
''; '';
} }

View file

@ -181,6 +181,22 @@
"type": "github" "type": "github"
} }
}, },
"lsp-progress": {
"flake": false,
"locked": {
"lastModified": 1721008335,
"narHash": "sha256-OafRT5AnxRTOh7MYofRFjti0+pobKQihymZs/kr5w0A=",
"owner": "linrongbin16",
"repo": "lsp-progress.nvim",
"rev": "d5f4d28efe75ce636bfbe271eb45f39689765aab",
"type": "github"
},
"original": {
"owner": "linrongbin16",
"repo": "lsp-progress.nvim",
"type": "github"
}
},
"nix-darwin": { "nix-darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -300,6 +316,7 @@
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"haskell-tools": "haskell-tools", "haskell-tools": "haskell-tools",
"lsp-progress": "lsp-progress",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixvim": "nixvim", "nixvim": "nixvim",
"render-markdown": "render-markdown", "render-markdown": "render-markdown",

View file

@ -19,6 +19,10 @@
url = "github:mrcjkb/haskell-tools.nvim"; url = "github:mrcjkb/haskell-tools.nvim";
flake = false; flake = false;
}; };
lsp-progress = {
url = "github:linrongbin16/lsp-progress.nvim";
flake = false;
};
}; };
outputs = outputs =