mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-31 15:19:26 +02:00
Show all LSP Clients attached to the Buffer in GalaxyLine Bar (#611)
* [UPDATE] change efm filetypes to only python * [UPDATE] shows all LSP Clients in galaxyline
This commit is contained in:
parent
ca057a2823
commit
f7132edd54
2 changed files with 31 additions and 2 deletions
|
@ -26,7 +26,7 @@ require"lspconfig".efm.setup {
|
||||||
-- init_options = {initializationOptions},
|
-- init_options = {initializationOptions},
|
||||||
cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"},
|
cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"},
|
||||||
init_options = {documentFormatting = true, codeAction = false},
|
init_options = {documentFormatting = true, codeAction = false},
|
||||||
filetypes = {"lua", "python", "javascriptreact", "javascript", "typescript","typescriptreact","sh", "html", "css", "yaml", "markdown", "vue"},
|
filetypes = {"python"},
|
||||||
settings = {
|
settings = {
|
||||||
rootMarkers = {".git/", "requirements.txt"},
|
rootMarkers = {".git/", "requirements.txt"},
|
||||||
languages = {
|
languages = {
|
||||||
|
|
|
@ -178,9 +178,38 @@ table.insert(gls.right, {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local get_lsp_client = function (msg)
|
||||||
|
msg = msg or "No Active LSP Client"
|
||||||
|
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
|
||||||
|
local lsps = ""
|
||||||
|
for _,client in ipairs(clients) do
|
||||||
|
local filetypes = client.config.filetypes
|
||||||
|
if filetypes and vim.fn.index(filetypes, buf_ft) ~=1 then
|
||||||
|
print(client.name)
|
||||||
|
if lsps == "" then
|
||||||
|
print("first", lsps)
|
||||||
|
lsps = client.name
|
||||||
|
else
|
||||||
|
lsps = lsps .. ", " .. client.name
|
||||||
|
print("more", lsps)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if lsps == "" then
|
||||||
|
return msg
|
||||||
|
else
|
||||||
|
return lsps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
table.insert(gls.right, {
|
table.insert(gls.right, {
|
||||||
ShowLspClient = {
|
ShowLspClient = {
|
||||||
provider = 'GetLspClient',
|
provider = get_lsp_client,
|
||||||
condition = function()
|
condition = function()
|
||||||
local tbl = {['dashboard'] = true, [' '] = true}
|
local tbl = {['dashboard'] = true, [' '] = true}
|
||||||
if tbl[vim.bo.filetype] then return false end
|
if tbl[vim.bo.filetype] then return false end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue