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

Error with `sign_placelist` in one repo but not another

Open brekk opened this issue 9 months ago • 0 comments

Hi there,

I'm seeing this error when :Coverage is run (in one repo, but it works fine in another repo).

Coverage E5108: Error executing lua Vim:E474: Invalid argument
│stack traceback:                                                                                                        │
│  [C]: in function 'sign_placelist'                                                                                     │
│  ...cal/share/nvim/lazy/nvim-coverage/lua/coverage/signs.lua:62: in function 'place'                                   │
│  ...ocal/share/nvim/lazy/nvim-coverage/lua/coverage/init.lua:56: in function 'callback'                                │
│  ...vim/lazy/nvim-coverage/lua/coverage/languages/madlib.lua:24: in function 'load'                                    │
│  ...ocal/share/nvim/lazy/nvim-coverage/lua/coverage/init.lua:47: in function 'load_lang'                               │
│  ...ocal/share/nvim/lazy/nvim-coverage/lua/coverage/init.lua:79: in function 'load'                                    │
│  [string ":lua"]:1: in main chunk

I'm using a custom language config:

  lang = {
    madlib = {
      coverage_file = ".coverage/lcov.info",
      coverage_command = "madlib test --coverage",
    }
  }

I added a file to: ~/.local/share/nvim/lazy/nvim-coverage/lua/coverage/languages: madlib.lua.

It's functionally the same as many others in the directory, but I've included it here for completeness.

local M = {}

local Path = require("plenary.path")
local common = require("coverage.languages.common")
local config = require("coverage.config")
local util = require("coverage.util")

--- Returns a list of signs to be placed.
M.sign_list = common.sign_list

--- Returns a summary report.
M.summary = common.summary

--- Loads a coverage report.
-- @param callback called with results of the coverage report
M.load = function(callback)
    local madlib_config = config.opts.lang.madlib
    local p = Path:new(util.get_coverage_file(madlib_config.coverage_file))
    if not p:exists() then
        vim.notify("No coverage file exists.", vim.log.levels.INFO)
        return
    end

    callback(util.lcov_to_table(p))
end

return M

I can post the generated lcov.info file if helpful.

Please let me know if there's any additional details I can provide.

Thanks for your time

brekk avatar May 26 '24 05:05 brekk