Merge pull request #165 from NotAShelf/lsp-statusline

This commit is contained in:
NotAShelf 2023-10-20 15:15:04 +03:00 committed by GitHub
commit 5789aa0d6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -184,19 +184,25 @@ in {
default = '' default = ''
{ {
{ {
-- Lsp server name . -- Lsp server name
function() function()
local buf_ft = vim.api.nvim_get_option_value('filetype', {}) local buf_ft = vim.api.nvim_get_option_value('filetype', {})
-- Check if the current buffer type is "toggleterm" -- List of buffer types to exclude
if buf_ft == "toggleterm" then local excluded_buf_ft = {"toggleterm", "NvimTree", "TelescopePrompt"}
return ""
-- Check if the current buffer type is in the excluded list
for _, excluded_type in ipairs(excluded_buf_ft) do
if buf_ft == excluded_type then
return ""
end
end end
local msg = 'No Active Lsp' -- Get the name of the LSP server active in the current buffer
local clients = vim.lsp.get_active_clients() local clients = vim.lsp.get_active_clients()
local msg = 'No Active Lsp'
-- if no lsp client is attached then return the msg
if next(clients) == nil then if next(clients) == nil then
return msg return msg
end end
@ -211,11 +217,13 @@ in {
return msg return msg
end, end,
icon = ' ', icon = ' ',
color = {bg='${colorPuccin}', fg='lavender'},
}, },
{ {
"diagnostics", "diagnostics",
sources = {'nvim_lsp', 'nvim_diagnostic', 'coc'}, sources = {'nvim_lsp', 'nvim_diagnostic', 'coc'},
symbols = {error = '󰅙 ', warn = ' ', info = ' ', hint = '󰌵 '}, symbols = {error = '󰅙 ', warn = ' ', info = ' ', hint = '󰌵 '},
color = {bg='${colorPuccin}', fg='lavender'},
diagnostics_color = { diagnostics_color = {
color_error = { fg = 'red' }, color_error = { fg = 'red' },
color_warn = { fg = 'yellow' }, color_warn = { fg = 'yellow' },