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 {
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
dependencies = { "nvim-tree/nvim-web-devicons", "folke/noice.nvim" },
event = { "BufEnter" },
config = true,
opts = {
@ -13,7 +13,7 @@ return {
sections = {
lualine_a = { "mode" },
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_y = { "progress" },
lualine_z = { "selectioncount", "location" },

View file

@ -7,6 +7,15 @@ return {
config = true,
opts = {
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 = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
@ -21,6 +30,8 @@ return {
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
presets = {
bottom_search = false, -- use a classic bottom cmdline for search