Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/nvim-coverage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ Valid keys for {opts.highlights}:
Valid keys for {opts.signs}:

covered: ~
Customize the highlight group and text used for covered signs.
Customize the highlight group and text used for covered signs. See :help sign_define for all supported options.
Defaults to: `{ hl = "CoverageCovered", text = "▎" }`
uncovered: ~
Customize the highlight group and text used for uncovered signs.
Customize the highlight group and text used for uncovered signs. See :help sign_define for all supported options.
Defaults to: `{ hl = "CoverageUncovered", text = "▎" }`
partial: ~
Customize the highlight group and text used for partial coverage signs.
Customize the highlight group and text used for partial coverage signs. See :help sign_define for all supported options.
Defaults to: `{ hl = "CoveragePartial", text = "▎" }`

*coverage.summary*
Expand Down
30 changes: 18 additions & 12 deletions lua/coverage/signs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,24 @@ local default_priority = 10

--- Defines signs.
M.setup = function()
vim.fn.sign_define(M.name("covered"), {
text = config.opts.signs.covered.text,
texthl = config.opts.signs.covered.hl,
})
vim.fn.sign_define(M.name("uncovered"), {
text = config.opts.signs.uncovered.text,
texthl = config.opts.signs.uncovered.hl,
})
vim.fn.sign_define(M.name("partial"), {
text = config.opts.signs.partial.text,
texthl = config.opts.signs.partial.hl,
})
local signs = config.opts.signs

if signs.covered["hl"] ~= nil then
signs.covered["texthl"] = signs.covered["hl"]
signs.covered["hl"] = nil
end
if signs.uncovered["hl"] ~= nil then
signs.uncovered["texthl"] = signs.uncovered["hl"]
signs.covered["hl"] = nil
end
if signs.partial["hl"] ~= nil then
signs.partial["texthl"] = signs.partial["hl"]
signs.covered["hl"] = nil
end

vim.fn.sign_define(M.name("covered"), config.opts.signs.covered)
vim.fn.sign_define(M.name("uncovered"), config.opts.signs.uncovered)
vim.fn.sign_define(M.name("partial"), config.opts.signs.partial)
end

--- Returns a namespaced sign name.
Expand Down