Add custom lsp progress to status bar using noice api

This commit is contained in:
Evie Litherland-Smith 2023-05-11 11:53:58 +01:00
parent dc65ffb590
commit 3aa74091ea
2 changed files with 13 additions and 2 deletions

View file

@ -1,6 +1,6 @@
return { return {
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" }, dependencies = { "nvim-tree/nvim-web-devicons", "folke/noice.nvim" },
event = { "BufEnter" }, event = { "BufEnter" },
config = true, config = true,
opts = { opts = {
@ -13,7 +13,7 @@ return {
sections = { sections = {
lualine_a = { "mode" }, lualine_a = { "mode" },
lualine_b = { "filename", { "branch", icon = "󰊢" }, "diff" }, lualine_b = { "filename", { "branch", icon = "󰊢" }, "diff" },
lualine_c = { "diagnostics" }, lualine_c = { "diagnostics", "require('noice').api.status.lsp.get_hl()" },
lualine_x = { "filetype", "fileformat", "encoding" }, lualine_x = { "filetype", "fileformat", "encoding" },
lualine_y = { "progress" }, lualine_y = { "progress" },
lualine_z = { "selectioncount", "location" }, lualine_z = { "selectioncount", "location" },

View file

@ -7,6 +7,15 @@ return {
config = true, config = true,
opts = { opts = {
lsp = { lsp = {
progress = {
enabled = true,
format = {
"({data.progress.percentage}%) ",
{ "{spinner} ", hl_group = "NoiceLspProgressSpinner" },
{ "{data.progress.title} ", hl_group = "NoiceLspProgressTitle" },
{ "{data.progress.client} ", hl_group = "NoiceLspProgressClient" },
},
},
-- override markdown rendering so that **cmp** and other plugins use **Treesitter** -- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = { override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true, ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
@ -21,6 +30,8 @@ return {
win_options = { winblend = 0 }, win_options = { winblend = 0 },
}, },
}, },
status = { lsp = { event = "lsp" } },
routes = { { view = "mini", filter = { event = "lsp" }, opts = { skip = true } } },
-- you can enable a preset for easier configuration -- you can enable a preset for easier configuration
presets = { presets = {
bottom_search = false, -- use a classic bottom cmdline for search bottom_search = false, -- use a classic bottom cmdline for search