Closed yavorski closed 5 months ago
Should be fixed, but would be great if you can confirm!
It does not throw, but it is not working either... Also it is printing directories now. It works when I create the ~/.config/nvim/lua/
dir manually. See screenshots.
Just removed that debug. Now I understand what you mean with init.lua. Will check
What does :=vim.lsp.buf.list_workspace_folders()
show?
I think this is the problem: https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/lua_ls.lua#L22
Your LuaLS is in single file mode, no workspace.
When you create the lua folder, you're in a workspace.
Although, even in that case it still works for me....
What does
:=vim.lsp.buf.list_workspace_folders()
show?
Empty table {}
I have added workaround to my config now to create the dir if it does not exists, so it's not a big deal.
Lazy.use {
"folke/lazydev.nvim",
-- dir = "~/dev/open-sos/lazydev.nvim",
dependencies = {{ "bilal2453/luvit-meta" }},
ft = "lua",
opts = {
library = { "luvit-meta/library" }
},
init = function()
local luadir = vim.fn.expand("~/.config/nvim/lua/")
if not vim.loop.fs_stat(luadir) then
vim.fn.mkdir(luadir)
end
end
}
This is my lua_ls
setup if it does matter
require("lspconfig").lua_ls.setup({
capabilities = LSP.capabilities(),
settings = {
Lua = {
format = { enable = true },
runtime = { version = "LuaJIT" },
diagnostics = { globals = { "vim" } },
completion = { callSnippet = "Replace" },
workspace = { checkThirdParty = "Disable" }
}
}
})
And this? :=vim.lsp.get_clients({name = "lua_ls"})[1].root_dir
nil,
Should work now with single file support
It is working now. Thank you!
Did you check docs and existing issues?
Neovim version (nvim -v)
0.10
Operating system/version
Arch Linux 6.9.3-arch1-1
Describe the bug
The plugin throws error when starting with
nvim ~/.config/nvim/init.lua
, but it works correctly when I am editing theinit.lua
in my repository directory. I think it throws when there isn't a lua directory e.g.~/.config/nvim/lua/
, e.g. when you have only singleinit.lua
file there. Here is the error.Steps To Reproduce
rm -r ~/.config/nvim/lua/
nvim ~/.config/nvim/init.lua
Expected Behavior
To not throw error and to work correctly.
Repro