Compare commits
1 commit
build/nix-
...
feat/statu
| Author | SHA1 | Date | |
|---|---|---|---|
| 51a99dd876 |
2 changed files with 22 additions and 0 deletions
|
|
@ -40,6 +40,7 @@
|
||||||
---@field clean fun(bufnr?: integer)
|
---@field clean fun(bufnr?: integer)
|
||||||
---@field toggle fun(bufnr?: integer)
|
---@field toggle fun(bufnr?: integer)
|
||||||
---@field status fun(bufnr?: integer): preview.Status
|
---@field status fun(bufnr?: integer): preview.Status
|
||||||
|
---@field statusline fun(bufnr?: integer): string
|
||||||
---@field get_config fun(): preview.Config
|
---@field get_config fun(): preview.Config
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
|
@ -179,6 +180,19 @@ function M.status(bufnr)
|
||||||
return compiler.status(bufnr)
|
return compiler.status(bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param bufnr? integer
|
||||||
|
---@return string
|
||||||
|
function M.statusline(bufnr)
|
||||||
|
bufnr = bufnr or vim.api.nvim_get_current_buf()
|
||||||
|
local s = compiler.status(bufnr)
|
||||||
|
if s.compiling then
|
||||||
|
return 'compiling'
|
||||||
|
elseif s.watching then
|
||||||
|
return 'watching'
|
||||||
|
end
|
||||||
|
return ''
|
||||||
|
end
|
||||||
|
|
||||||
M._test = {
|
M._test = {
|
||||||
---@diagnostic disable-next-line: assign-type-mismatch
|
---@diagnostic disable-next-line: assign-type-mismatch
|
||||||
reset = function()
|
reset = function()
|
||||||
|
|
|
||||||
|
|
@ -100,4 +100,12 @@ describe('preview', function()
|
||||||
helpers.delete_buffer(bufnr)
|
helpers.delete_buffer(bufnr)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
describe('statusline', function()
|
||||||
|
it('returns empty string when idle', function()
|
||||||
|
local bufnr = helpers.create_buffer({})
|
||||||
|
assert.are.equal('', preview.statusline(bufnr))
|
||||||
|
helpers.delete_buffer(bufnr)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue