diff --git a/lua/neotest/consumers/output_panel/init.lua b/lua/neotest/consumers/output_panel/init.lua index 1104f7ad..ddb12180 100644 --- a/lua/neotest/consumers/output_panel/init.lua +++ b/lua/neotest/consumers/output_panel/init.lua @@ -6,6 +6,10 @@ local OutputPanel = require("neotest.consumers.output_panel.panel") ---@type neotest.OutputPanel local panel +---@private +---@type number +local chan + local neotest = {} ---@toc_entry Output Panel Consumer @@ -19,7 +23,6 @@ neotest.output_panel = {} local init = function(client) panel = OutputPanel(client) - local chan ---@param results table client.listeners.results = function(adapter_id, results, partial) if partial then @@ -83,6 +86,16 @@ function neotest.output_panel.toggle() end end +--- Clears the output panel +--- >vim +--- lua require("neotest").output_panel.clear() +--- < +function neotest.output_panel.clear() + if chan then + vim.api.nvim_chan_send(chan, "\x1b[H\x1b[2J") + end +end + neotest.output_panel = setmetatable(neotest.output_panel, { __call = function(_, client) init(client)