folke / neoconf.nvim

💼 Neovim plugin to manage global and project-local settings
Apache License 2.0
715 stars 29 forks source link

bug: nil root_dir #51

Closed Tmpod closed 3 months ago

Tmpod commented 8 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.9.5 Release

Operating system/version

Linux 6.6

Describe the bug

When starting a Slint LSP, I get the following error:

[lspconfig] unhandled error: ....local/share/nvim/lazy/neoconf.nvim/lua/neoconf/util.lua:54: attempt to call upvalue 'root_dir' (a nil value)

And the server isn't started.

Steps To Reproduce

  1. Install the server through Mason
  2. Open a Slint file
  3. If you don't have automatic filetype detection already, do :se ft=slint
  4. If the LSP didn't try to start automatically, do :LspStart
  5. You should see the error pop out.

Expected Behavior

The LSP starts without errors.

Repro

-- With this repro, the server still doesn't start but I don't get the error either... 
-- My regular setup uses LazyVim. Should I open an issue there?

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
    vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
    "folke/tokyonight.nvim",
    "folke/neoconf.nvim",
    "williamboman/mason-lspconfig.nvim",
    {
        "williamboman/mason.nvim",
        config = function()
            require("mason").setup()
            require("mason-lspconfig").setup({
                ensure_installed = { "slint_lsp" },
            })
        end,
    },
    "neovim/nvim-lspconfig",
    -- add any other plugins here
}
require("lazy").setup(plugins, {
    root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
PyDev19 commented 8 months ago

same issue here don't know how to resolve it

Youngsie1997 commented 8 months ago

Same issue here also would love to know how to resolve it if either of you manage to find a solution.

ecruzolivera commented 7 months ago

same issue here, im using astronvim version: v3.43.4 and neoconf version 1.2.2 main commit f8947e9

https://github.com/folke/neoconf.nvim/blob/4ef6c6c5882e7e16209173fb8c47414202843384/lua/neoconf/util.lua#L51-L54

Im not familiar with lua, but should not be:

 if initial_config.root_dir then

or

local root_dir = opts.root_dir
github-actions[bot] commented 3 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.