Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with sign_placelist in one repo but not another #52

Open
brekk opened this issue May 26, 2024 · 0 comments
Open

Error with sign_placelist in one repo but not another #52

brekk opened this issue May 26, 2024 · 0 comments

Comments

@brekk
Copy link

brekk commented May 26, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant