Shatur / neovim-tasks

A statefull task manager focused on integration with build systems.
GNU General Public License v3.0
108 stars 10 forks source link

Error when exec command `Task set_module_param cmake target` #25

Closed TropinoneH closed 4 months ago

TropinoneH commented 5 months ago

Bug report When I try to use Task set_module_param cmake target, after select 1 and press enter, nvim reports an error:

Error executing Lua callback: ...nvim/site/lazy/neovim-tasks/lua/tasks/project_config.lua:28: Cannot serialise function: type not supported
stack traceback:
[C]: in function 'encode'
...nvim/site/lazy/neovim-tasks/lua/tasks/project_config.lua:28: in function 'write'
...cal/share/nvim/site/lazy/neovim-tasks/lua/tasks/init.lua:68: in function 'on_confirm'
.../.mount_nvimDMVrrM/usr/share/nvim/runtime/lua/vim/ui.lua:103: in function 'input'
...cal/share/nvim/site/lazy/neovim-tasks/lua/tasks/init.lua:66: in function 'subcommand_func'
...re/nvim/site/lazy/neovim-tasks/lua/tasks/subcommands.lua:76: in function <...re/nvim/site/lazy/neovim-tasks/lua/tasks/subcommands.lua:62>

I checked the previous neovim-cmake repository and found this: (I'm not sure if the two are related)

lua print(table.unpack({1, 2, 3}))

The result of my execution is an error:

Error executing lua [string ":lua"]:1: attempt to call field 'unpack' (a nil value) stack traceback

My neovim version and LuaJIT version are:

$ nvim --version
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1692716794

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info

Minimum Configuration

use lazy.nvim:

return {
    "Shatur/neovim-tasks",
    lazy = true,
    opts = function()
        local Path = require("plenary.path")
        return {
            default_params = {
                cmake = {
                    cmd = "cmake",
                    build_dir = tostring(Path:new("{cwd}", "cmake-build-{build_type}")),
                    build_type = "Debug",
                    dap_name = "codelldb",
                    args = {
                        configure = {
                            "-D",
                            "CMAKE_MAKE_PROGRAM=ninja",
                            "-D",
                            "CMAKE_C_COMPILER=gcc",
                            "-G",
                            "Ninja",
                        },
                        build = {
                            "-j18",
                        },
                    },
                    save_before_run = true,
                    params_file = "neovim.json",
                    quickfix = {
                        pos = "botright", -- Default quickfix position.
                        height = 12, -- Default height.
                    },
                    dap_open_command = function()
                        return require("dap").repl.open()
                    end,
                },
            },
        }
    end,
    cmd = { "Tasks" },
    ft = { "c", "cpp", "cmake", "make" },
    dependencies = {
        "nvim-lua/plenary.nvim",
    },
    config = function(_, opts)
        require("tasks").setup(opts)
    end,
}
Shatur commented 5 months ago

You need to update to 0.10. I wondering why this check doesn't trigger:

https://github.com/Shatur/neovim-tasks/blob/7a73b5bbe67e12c8b23304825c3a239c43d07fed/plugin/tasks.lua#L1

Shatur commented 4 months ago

Fixed the check by 99055e0a419c576646c0e9f0eb974c82add7c85d