Coverage display using overlay extmarks instead of signs
I managed to implement overlays visual in case someone might need
https://github.com/andythigpen/nvim-coverage/assets/13571960/08bce7ae-fc61-434d-83bd-0eb3ac72a9d3
I prefer as less signs in my sign column as possible. So I tweaks this plugin a little bit for my preferences. I want to keep minimal changes, So all you need is to replace signs with overlays file here and overwrite any part that show signs.
Basically, you extended the languages you want to have return overlays_list, (or just replace sign_list with overlay call) https://github.com/hieulw/nvimrc/blob/lua-config/lua/coverage/languages/go.lua#L15-L51
Then override some coverage functions like load(), show(), unplace(), toggle() and clear() to use overlay, you don't have to do this if you just replace sign with overlays in the language files.
function M.setup(_, opts)
local coverage = require("coverage")
local overlays = require("coverage.overlays")
local watch = require("coverage.watch")
coverage.load = M.load
coverage.show = overlays.show
coverage.hide = overlays.unplace
coverage.toggle = overlays.toggle
---@diagnostic disable-next-line: duplicate-set-field
coverage.clear = function()
overlays.clear()
watch.stop()
end
coverage.setup(opts)
end
What would make this extra useful is if the overlay structure would allow to specify columns as well. The coverage data I’m working with uses regions that are line+column based, and allow partial coverage of a line. This is something you can’t represent with the sign column.