summaryrefslogtreecommitdiff
path: root/lua/core/galaxyline.lua
diff options
context:
space:
mode:
authorkylo252 <[email protected]>2021-07-28 03:04:51 +0200
committerGitHub <[email protected]>2021-07-27 21:04:51 -0400
commitc07b0c47317f2ae63682204a772d5ce15cb67aac (patch)
treebda4b3e9a36cfb2b777b985c9e0c8fd5482260a0 /lua/core/galaxyline.lua
parent58bd5fe93c4fb0040709a330b735ef5523ac15d2 (diff)
feat: resolve null-ls tag in galaxyline (#1138)
Diffstat (limited to 'lua/core/galaxyline.lua')
-rw-r--r--lua/core/galaxyline.lua37
1 files changed, 13 insertions, 24 deletions
diff --git a/lua/core/galaxyline.lua b/lua/core/galaxyline.lua
index abc7c369..1cc855ee 100644
--- a/lua/core/galaxyline.lua
+++ b/lua/core/galaxyline.lua
@@ -200,39 +200,28 @@ table.insert(gls.right, {
},
})
-local get_lsp_client = function(msg)
+local function get_attached_provider_name(msg)
msg = msg or "LSP Inactive"
- local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
- local clients = vim.lsp.get_active_clients()
- if next(clients) == nil then
+
+ local buf_ft = vim.bo.filetype
+ local buf_clients = vim.lsp.buf_get_clients()
+ if next(buf_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
- if not string.find(lsps, client.name) then
- lsps = lsps .. ", " .. client.name
- end
- -- print("more", lsps)
- end
+ local buf_client_names = {}
+ for _, client in pairs(buf_clients) do
+ if client.name == "null-ls" then
+ table.insert(buf_client_names, lvim.lang[buf_ft].linters[1])
+ else
+ table.insert(buf_client_names, client.name)
end
end
- if lsps == "" then
- return msg
- else
- return lsps
- end
+ return table.concat(buf_client_names, ", ")
end
table.insert(gls.right, {
ShowLspClient = {
- provider = get_lsp_client,
+ provider = get_attached_provider_name,
condition = function()
local tbl = { ["dashboard"] = true, [" "] = true }
if tbl[vim.bo.filetype] then