Skip to content

Commit 1d93501

Browse files
committed
fix(status): improve lsp_client_names mappings configuration
1 parent 4b1a46e commit 1d93501

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

lua/astroui/status/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108

109109
---@class AstroUIProviderLspClientNamesOpts: AstroUIStatusStylizeOpts
110110
---@field integrations { null_ls: boolean?, conform: boolean?, nvim-lint: boolean? }? enable or disable client name integrations
111-
---@field mappings { [string]: (string|fun(client: string): string)? }? add custom client name mappings ("*" will apply to all as a fallback)
111+
---@field mappings { [string]: false|string|fun(client: string): (false|string|nil) }? add custom client name mappings ("*" will apply to all as a fallback)
112112
---@field truncate number? percentage of statusline of the maximum width before truncation with ellipsis
113113

114114
---@class AstroUIProviderVirtualEnvOpts: AstroUIStatusStylizeOpts

lua/astroui/status/provider.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,14 @@ function M.lsp_client_names(opts)
545545
local buf_client_names_set, client_name_lookup = {}, {}
546546
for _, client in ipairs(buf_client_names) do
547547
local mapping = opts.mappings and (opts.mappings[client] or opts.mappings["*"])
548-
if mapping then client = type(mapping) == "string" and mapping or mapping(client) end
549-
if opts.mappings and opts.mappings[client] then client = opts.mappings[client] end
550-
if not client_name_lookup[client] then
548+
if mapping then
549+
if type(mapping) == "function" then
550+
client = mapping(client)
551+
else
552+
client = mapping
553+
end
554+
end
555+
if client and client ~= "" and not client_name_lookup[client] then
551556
client_name_lookup[client] = true
552557
table.insert(buf_client_names_set, client)
553558
end

0 commit comments

Comments
 (0)