From 8feac6c6774187c5d84aca26db51f32c7a2da041 Mon Sep 17 00:00:00 2001 From: Jan Steinke Date: Sat, 22 Jan 2022 23:13:57 +0100 Subject: [PATCH] add function to add LSP client names (#30) --- lua/hardline/parts/lsp.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lua/hardline/parts/lsp.lua b/lua/hardline/parts/lsp.lua index 6b2ee34..7af48e9 100644 --- a/lua/hardline/parts/lsp.lua +++ b/lua/hardline/parts/lsp.lua @@ -26,7 +26,21 @@ local function get_warning() return get_diagnostic('W', 'Warning') end +local function get_lsp_clients() + local clients = vim.lsp.buf_get_clients() + if next(clients) == nil then + return "none" + end + + local c = {} + for _, client in ipairs(clients) do + table.insert(c, client.name) + end + return table.concat(c, "|") +end + return { get_error = get_error, get_warning = get_warning, + get_lsp_clients = get_lsp_clients, }