mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +00:00
Merge pull request #160 from NotAShelf/conditional-lsp-status
This commit is contained in:
commit
dde897606b
1 changed files with 11 additions and 1 deletions
|
@ -185,19 +185,29 @@ in {
|
|||
{
|
||||
{
|
||||
-- Lsp server name .
|
||||
|
||||
function()
|
||||
local buf_ft = vim.api.nvim_get_option_value('filetype', {})
|
||||
|
||||
-- Check if the current buffer type is "toggleterm"
|
||||
if buf_ft == "toggleterm" then
|
||||
return ""
|
||||
end
|
||||
|
||||
local msg = 'No Active Lsp'
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
|
||||
if next(clients) == nil then
|
||||
return msg
|
||||
end
|
||||
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
return client.name
|
||||
end
|
||||
end
|
||||
|
||||
return msg
|
||||
end,
|
||||
icon = ' ',
|
||||
|
|
Loading…
Reference in a new issue