nvim-coverage icon indicating copy to clipboard operation
nvim-coverage copied to clipboard

Coverage display using overlay extmarks instead of signs

Open hieulw opened this issue 9 months ago • 0 comments

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

hieulw avatar May 08 '24 04:05 hieulw