refactor(providers): Let get_status() return a list of strings instead

This commit is contained in:
hedy
2023-11-19 19:02:00 +08:00
parent 9b90379c7a
commit 3762402dd3
3 changed files with 4 additions and 5 deletions

View File

@@ -128,8 +128,7 @@ function M.show_status(ctx)
if p.get_status then if p.get_status then
table.insert(lines, 'Provider info:') table.insert(lines, 'Provider info:')
table.insert(lines, '') table.insert(lines, '')
local l = p.get_status() for _, line in ipairs(p.get_status()) do
for _, line in ipairs(vim.split(l, '\n', { plain = true, trimempty = false })) do
table.insert(lines, indent .. line) table.insert(lines, indent .. line)
end end
end end

View File

@@ -10,9 +10,9 @@ local M = {
function M.get_status() function M.get_status()
if not M.client then if not M.client then
return 'No clients' return { 'No clients' }
end end
return 'client: ' .. M.client.name return { 'client: ' .. M.client.name }
end end
local function get_params() local function get_params()

View File

@@ -69,7 +69,7 @@
---@field hover_info fun(bufnr:integer, params:table, on_info:function) ---@field hover_info fun(bufnr:integer, params:table, on_info:function)
---@field request_symbols fun(on_symbols:function, opts:table) ---@field request_symbols fun(on_symbols:function, opts:table)
---@field name string ---@field name string
---@field get_status? fun():string ---@field get_status? fun():string[]
-- HELP -- HELP