-
Notifications
You must be signed in to change notification settings - Fork 6
lsp‐component
Zeioth edited this page Apr 3, 2024
·
6 revisions
You can add this component to the statusline section of heirline opts.
require("heirline-components.all").component.lsp()
You can see how this component look on the right of the next image: It will show the currently loaded lsp clients. While the clients are loading, you will see a % load indicator.
These are the available providers for this component and its options.
lsp_progress = {
str = "",
padding = { right = 1 },
update = {
"User",
pattern = { "HeirlineComponentsUpdateLspProgress" },
callback = vim.schedule_wrap(function() vim.cmd.redrawstatus() end),
},
init = require("heirline-components.core.init").lsp_progress()
},
lsp_client_names = {
str = "LSP",
update = {
"LspAttach",
"LspDetach",
"BufEnter",
"VimResized",
callback = vim.schedule_wrap(function() vim.cmd.redrawstatus() end),
},
icon = { kind = "ActiveLSP", padding = { right = 2 } },
},
hl = hl.get_attributes "lsp",
surround = {
separator = "right",
color = "lsp_bg",
condition = condition.lsp_attached,
},
on_click = {
name = "heirline_lsp",
callback = function() vim.schedule(vim.cmd.LspInfo) end,
},
For example to disable the lsp client names:
component.lsp({ lsp_client_names = false })
The provider lsp_progress
can be manually updated by triggering the event User HeirlineComponentsUpdateLspProgress
. But this is not necessary.