|  | @@ -14,7 +14,7 @@ local text = require "lvim.interface.text"
 | 
	
		
			
				|  |  |  local lsp_utils = require "lvim.lsp.utils"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  local function str_list(list)
 | 
	
		
			
				|  |  | -  return fmt("[ %s ]", table.concat(list, ", "))
 | 
	
		
			
				|  |  | +  return #list == 1 and list[1] or fmt("[%s]", table.concat(list, ", "))
 | 
	
		
			
				|  |  |  end
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  local function make_formatters_info(ft)
 | 
	
	
		
			
				|  | @@ -73,21 +73,23 @@ local function tbl_set_highlight(terms, highlight_group)
 | 
	
		
			
				|  |  |  end
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  local function make_client_info(client)
 | 
	
		
			
				|  |  | +  if client.name == "null-ls" then
 | 
	
		
			
				|  |  | +    return
 | 
	
		
			
				|  |  | +  end
 | 
	
		
			
				|  |  |    local client_enabled_caps = lsp_utils.get_client_capabilities(client.id)
 | 
	
		
			
				|  |  |    local name = client.name
 | 
	
		
			
				|  |  |    local id = client.id
 | 
	
		
			
				|  |  |    local filetypes = lsp_utils.get_supported_filetypes(name)
 | 
	
		
			
				|  |  | -  local document_formatting = client.resolved_capabilities.document_formatting
 | 
	
		
			
				|  |  | -  local attached_buffers_list = table.concat(vim.lsp.get_buffers_by_client_id(client.id), ", ")
 | 
	
		
			
				|  |  | +  local attached_buffers_list = str_list(vim.lsp.get_buffers_by_client_id(client.id))
 | 
	
		
			
				|  |  |    local client_info = {
 | 
	
		
			
				|  |  | -    fmt("* Name:                      %s", name),
 | 
	
		
			
				|  |  | -    fmt("* Id:                        [%s]", tostring(id)),
 | 
	
		
			
				|  |  | -    fmt("* filetype(s):               [%s]", table.concat(filetypes, ", ")),
 | 
	
		
			
				|  |  | -    fmt("* Attached buffers:          [%s]", tostring(attached_buffers_list)),
 | 
	
		
			
				|  |  | -    fmt("* Supports formatting:       %s", tostring(document_formatting)),
 | 
	
		
			
				|  |  | +    fmt("* name:                      %s", name),
 | 
	
		
			
				|  |  | +    fmt("* id:                        %s", tostring(id)),
 | 
	
		
			
				|  |  | +    fmt("* supported filetype(s):     %s", str_list(filetypes)),
 | 
	
		
			
				|  |  | +    fmt("* attached buffers:          %s", tostring(attached_buffers_list)),
 | 
	
		
			
				|  |  | +    fmt("* root_dir pattern:          %s", tostring(attached_buffers_list)),
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |    if not vim.tbl_isempty(client_enabled_caps) then
 | 
	
		
			
				|  |  | -    local caps_text = "* Capabilities list:         "
 | 
	
		
			
				|  |  | +    local caps_text = "* capabilities:              "
 | 
	
		
			
				|  |  |      local caps_text_len = caps_text:len()
 | 
	
		
			
				|  |  |      local enabled_caps = text.format_table(client_enabled_caps, 3, " | ")
 | 
	
		
			
				|  |  |      enabled_caps = text.shift_right(enabled_caps, caps_text_len)
 | 
	
	
		
			
				|  | @@ -98,8 +100,27 @@ local function make_client_info(client)
 | 
	
		
			
				|  |  |    return client_info
 | 
	
		
			
				|  |  |  end
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +local function make_override_info(ft)
 | 
	
		
			
				|  |  | +  local available = lsp_utils.get_supported_servers_per_filetype(ft)
 | 
	
		
			
				|  |  | +  local overridden = vim.tbl_filter(function(name)
 | 
	
		
			
				|  |  | +    return vim.tbl_contains(available, name)
 | 
	
		
			
				|  |  | +  end, lvim.lsp.override)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  local info_lines = { "" }
 | 
	
		
			
				|  |  | +  if #overridden == 0 then
 | 
	
		
			
				|  |  | +    return info_lines
 | 
	
		
			
				|  |  | +  end
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  info_lines = {
 | 
	
		
			
				|  |  | +    fmt("Overridden %s server(s)", ft),
 | 
	
		
			
				|  |  | +    fmt("* list: %s", str_list(overridden)),
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  return info_lines
 | 
	
		
			
				|  |  | +end
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  function M.toggle_popup(ft)
 | 
	
		
			
				|  |  | -  local clients = lsp_utils.get_active_clients_by_ft(ft)
 | 
	
		
			
				|  |  | +  local clients = vim.lsp.get_active_clients(ft)
 | 
	
		
			
				|  |  |    local client_names = {}
 | 
	
		
			
				|  |  |    local bufnr = vim.api.nvim_get_current_buf()
 | 
	
		
			
				|  |  |    local ts_active_buffers = vim.tbl_keys(vim.treesitter.highlighter.active)
 | 
	
	
		
			
				|  | @@ -111,26 +132,26 @@ function M.toggle_popup(ft)
 | 
	
		
			
				|  |  |      return status
 | 
	
		
			
				|  |  |    end
 | 
	
		
			
				|  |  |    local header = {
 | 
	
		
			
				|  |  | -    fmt("Detected filetype:           %s", ft),
 | 
	
		
			
				|  |  | -    fmt("Current buffer number:       [%s]", bufnr),
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  local ts_info = {
 | 
	
		
			
				|  |  | -    "Treesitter info",
 | 
	
		
			
				|  |  | -    fmt("* current buffer:            %s", is_treesitter_active()),
 | 
	
		
			
				|  |  | -    fmt("* list:                      [%s]", table.concat(ts_active_buffers, ", ")),
 | 
	
		
			
				|  |  | +    "Buffer info",
 | 
	
		
			
				|  |  | +    fmt("* filetype:                %s", ft),
 | 
	
		
			
				|  |  | +    fmt("* bufnr:                   %s", bufnr),
 | 
	
		
			
				|  |  | +    fmt("* treesitter status:       %s", is_treesitter_active()),
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    local lsp_info = {
 | 
	
		
			
				|  |  | -    "Language Server Protocol (LSP) info",
 | 
	
		
			
				|  |  | -    fmt "* Active server(s):",
 | 
	
		
			
				|  |  | +    "Active client(s)",
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    for _, client in pairs(clients) do
 | 
	
		
			
				|  |  | -    vim.list_extend(lsp_info, make_client_info(client))
 | 
	
		
			
				|  |  | +    local client_info = make_client_info(client)
 | 
	
		
			
				|  |  | +    if client_info then
 | 
	
		
			
				|  |  | +      vim.list_extend(lsp_info, client_info)
 | 
	
		
			
				|  |  | +    end
 | 
	
		
			
				|  |  |      table.insert(client_names, client.name)
 | 
	
		
			
				|  |  |    end
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +  local override_info = make_override_info(ft)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    local formatters_info = make_formatters_info(ft)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    local linters_info = make_linters_info(ft)
 | 
	
	
		
			
				|  | @@ -146,10 +167,10 @@ function M.toggle_popup(ft)
 | 
	
		
			
				|  |  |        { "" },
 | 
	
		
			
				|  |  |        header,
 | 
	
		
			
				|  |  |        { "" },
 | 
	
		
			
				|  |  | -      ts_info,
 | 
	
		
			
				|  |  | -      { "" },
 | 
	
		
			
				|  |  |        lsp_info,
 | 
	
		
			
				|  |  |        { "" },
 | 
	
		
			
				|  |  | +      override_info,
 | 
	
		
			
				|  |  | +      { "" },
 | 
	
		
			
				|  |  |        formatters_info,
 | 
	
		
			
				|  |  |        { "" },
 | 
	
		
			
				|  |  |        linters_info,
 | 
	
	
		
			
				|  | @@ -165,8 +186,9 @@ function M.toggle_popup(ft)
 | 
	
		
			
				|  |  |    local function set_syntax_hl()
 | 
	
		
			
				|  |  |      vim.cmd [[highlight LvimInfoIdentifier gui=bold]]
 | 
	
		
			
				|  |  |      vim.cmd [[highlight link LvimInfoHeader Type]]
 | 
	
		
			
				|  |  | -    vim.fn.matchadd("LvimInfoHeader", "Treesitter info")
 | 
	
		
			
				|  |  | -    vim.fn.matchadd("LvimInfoHeader", "Language Server Protocol (LSP) info")
 | 
	
		
			
				|  |  | +    vim.fn.matchadd("LvimInfoHeader", "Buffer info")
 | 
	
		
			
				|  |  | +    vim.fn.matchadd("LvimInfoHeader", "Active client(s)")
 | 
	
		
			
				|  |  | +    vim.fn.matchadd("LvimInfoHeader", fmt("Overridden %s server(s)", ft))
 | 
	
		
			
				|  |  |      vim.fn.matchadd("LvimInfoHeader", "Formatters info")
 | 
	
		
			
				|  |  |      vim.fn.matchadd("LvimInfoHeader", "Linters info")
 | 
	
		
			
				|  |  |      vim.fn.matchadd("LvimInfoHeader", "Code actions info")
 |