diff options
Diffstat (limited to 'lua/core')
| -rw-r--r-- | lua/core/galaxyline.lua | 30 | 
1 files changed, 9 insertions, 21 deletions
| diff --git a/lua/core/galaxyline.lua b/lua/core/galaxyline.lua index cf7d35d0..2aae0242 100644 --- a/lua/core/galaxyline.lua +++ b/lua/core/galaxyline.lua @@ -6,6 +6,8 @@ if not status_ok then    return  end +local utils = require "utils" +  -- NOTE: if someone defines colors but doesn't have them then this will break  local palette_status_ok, colors = pcall(require, lvim.colorscheme .. ".palette")  if not palette_status_ok then @@ -200,36 +202,22 @@ table.insert(gls.right, {    },  }) --- TODO: this function doesn't need to be this complicated  local function get_attached_provider_name(msg)    msg = msg or "LSP Inactive" -  local buf_ft = vim.bo.filetype    local buf_clients = vim.lsp.buf_get_clients()    if next(buf_clients) == nil then      return msg    end - -  local utils = require "utils" -  local config = require("null-ls.config").get() -  local builtins = require "null-ls.builtins" -  -- concat all the builtin formatters and linters from null-ls -  local all_things = builtins.formatting -  for k, v in pairs(builtins.diagnostics) do -    all_things[k] = v -  end - -  -- if we open multiple filetypes in the same session -  -- null-ls will register multiple formatter/linters -  -- but only use the ones that support vim.bo.filetype -  -- so we need to filter them +  local buf_ft = vim.bo.filetype    local buf_client_names = {} +  local null_ls_providers = require("lsp.null-ls").requested_providers    for _, client in pairs(buf_clients) do      if client.name == "null-ls" then -      -- for every registered formatter/linter in the current buffer -      for _, v in pairs(config._names) do -        -- show only the ones that are being used for the current filetype -        if utils.has_value(all_things[v].filetypes, buf_ft) then -          table.insert(buf_client_names, v) +      for _, provider in pairs(null_ls_providers) do +        if vim.tbl_contains(provider.filetypes, buf_ft) then +          if not vim.tbl_contains(buf_client_names, provider.name) then +            table.insert(buf_client_names, provider.name) +          end          end        end      else | 
