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 on saving #136

Closed
xsteadfastx opened this issue Dec 13, 2021 · 2 comments
Closed

error on saving #136

xsteadfastx opened this issue Dec 13, 2021 · 2 comments

Comments

@xsteadfastx
Copy link

i get this error on saving my nvim lua config. if i revert to commit fe16081 it works.

".config/nvim/init.lua" 571L, 18653C written
Error detected while processing BufWritePost Autocommands for "<buffer=1>":
E5108: Error executing lua vim/shared.lua:187: t: expected table, got nil
stack traceback:
        [C]: in function 'error'
        vim/shared.lua:608: in function 'validate'
        vim/shared.lua:187: in function 'tbl_map'
        ...share/nvim/site/pack/packer/start/nvim-lint/lua/lint.lua:91: in function 'try_lint'
        [string ":lua"]:1: in main chunk

here is the config:

            use {
                "mfussenegger/nvim-lint",
                config = function()
                    local lint = require "lint"
                    lint.linters.golangcilint.args = {
                        "run",
                        "--enable-all",
                        "--disable=godox,tagliatelle,exhaustivestruct,varnamelen",
                        "--build-tags=integration",
                        "--out-format",
                        "json"
                    }
                    lint.linters_by_ft = {
                        go = {"golangcilint"},
                        sh = {"shellcheck"},
                        ansible = {"ansible_lint"}
                    }
                end
            }

and

local function nvim_create_augroups(definitions)
    for group_name, definition in pairs(definitions) do
        api.nvim_command("augroup " .. group_name)
        api.nvim_command("autocmd!")
        for _, def in ipairs(definition) do
            -- if type(def) == 'table' and type(def[#def]) == 'function' then
            -- 	def[#def] = lua_callback(def[#def])
            -- end
            local command = table.concat(vim.tbl_flatten {"autocmd", def}, " ")
            api.nvim_command(command)
        end
        api.nvim_command("augroup END")
    end
end

nvim_create_augroups({lint = {{"BufWritePost", "<buffer>", "lua require('lint').try_lint()"}}})
@mfussenegger
Copy link
Owner

Thanks for pointing out.

Should be fixed with #137

@xsteadfastx
Copy link
Author

looks fine :) thanks for this amazing piece of software!

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

2 participants