LhKipp / nvim-nu

Basic editor support for the nushell language
GNU General Public License v3.0
134 stars 10 forks source link

Error: Executable not found #9

Closed jeeeem closed 5 months ago

jeeeem commented 1 year ago

Although I have this ugly work around, I may still need some info how to remove this error

For context: I am using lunarvim so it is using lazy.nvim

config = function ()
    require('nu').setup({})
    vim.schedule(function ()
    vim.cmd[[set filetype=nu]]
    end)
end

It works though image image image

but I am still having this error whenever I open ~nu script~ lunarvim. I just realized it shows the error whenever I open the lunarvim, so I guess I will comment the plugin first before I find the fix.

image image

LhKipp commented 1 year ago

Hi jeeeem,

thanks for opening this issue.

The error comes from this piece of code:

-- nvim-nu/lua/nu/lsp.lua

    local proc = Job:new({
        command = "sh",
        args = { "-c", cmd },
        cwd = '.',
        enable_recording = true,
    })
    proc:start()
    proc:wait()

You are using the default configuration so cmd is [[nu -c 'help commands | get name | str join "\n"']].

I guess you don't have sh in your PATH? Are you on windows?

You can try passing a different value for all_cmd_names in the configuration (see README.md). E.G.:

require'nu'.setup{
    use_lsp_features = true, -- requires https://github.com/jose-elias-alvarez/null-ls.nvim
    all_cmd_names = function() /* TODO windows logic here to retrieve cmd names */ end
}

The error should be gone then.

Please let me know, whether this fixes your error.

Cheers

LhKipp commented 5 months ago

sh is no longer expected to be on the PATH. Instead nu is now required to be executable.