From 3762402dd3f499a8ecdf965c1cb90f37c4f27da8 Mon Sep 17 00:00:00 2001 From: hedy Date: Sun, 19 Nov 2023 19:02:00 +0800 Subject: [PATCH] refactor(providers): Let get_status() return a list of strings instead --- lua/outline/docs.lua | 3 +-- lua/outline/providers/nvim-lsp.lua | 4 ++-- lua/outline/types/outline.lua | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lua/outline/docs.lua b/lua/outline/docs.lua index c0abbb5..1c0b85e 100644 --- a/lua/outline/docs.lua +++ b/lua/outline/docs.lua @@ -128,8 +128,7 @@ function M.show_status(ctx) if p.get_status then table.insert(lines, 'Provider info:') table.insert(lines, '') - local l = p.get_status() - for _, line in ipairs(vim.split(l, '\n', { plain = true, trimempty = false })) do + for _, line in ipairs(p.get_status()) do table.insert(lines, indent .. line) end end diff --git a/lua/outline/providers/nvim-lsp.lua b/lua/outline/providers/nvim-lsp.lua index 915dd6b..62ea995 100644 --- a/lua/outline/providers/nvim-lsp.lua +++ b/lua/outline/providers/nvim-lsp.lua @@ -10,9 +10,9 @@ local M = { function M.get_status() if not M.client then - return 'No clients' + return { 'No clients' } end - return 'client: ' .. M.client.name + return { 'client: ' .. M.client.name } end local function get_params() diff --git a/lua/outline/types/outline.lua b/lua/outline/types/outline.lua index 85b4c53..158fb03 100644 --- a/lua/outline/types/outline.lua +++ b/lua/outline/types/outline.lua @@ -69,7 +69,7 @@ ---@field hover_info fun(bufnr:integer, params:table, on_info:function) ---@field request_symbols fun(on_symbols:function, opts:table) ---@field name string ----@field get_status? fun():string +---@field get_status? fun():string[] -- HELP