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

bug: no completions in ~/.config/nvim/after directory #179

Open
3 tasks done
Danielkonge opened this issue Jan 26, 2024 · 4 comments
Open
3 tasks done

bug: no completions in ~/.config/nvim/after directory #179

Danielkonge opened this issue Jan 26, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Danielkonge
Copy link

Danielkonge commented Jan 26, 2024

Did you check docs and existing issues?

  • I have read all the neodev.nvim docs
  • I have searched the existing issues of neodev.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.10.0-dev-1e0996b57

Operating system/version

macOS 14.2.1

Describe the bug

I updated my plugins via Lazy today, and neodev doesn't seem to work in my after directory anymore, but it does still work in ~/.config/nvim/lua/myname. (It also doesn't work in the directory with my local versions of plugins.)

Completions and type information worked until I updated and I assume something with the paths changed? (I don't know if this is related to #178?)

When I tell Lazy to use commit 3941036e3da9b0dc09244036d20c590b6d752175, everything works as expected.

Steps To Reproduce

Try to get completions or type details for vim.<anything> in the after directory.

If you can't replicate this, I can try to make more detailed reproduction steps, but I assume it is an issue with the paths in general.

My neodev setup is just:

require('neodev').setup({})

Expected Behavior

I should be able to get neodev type information in the after folder.

Repro

-- I just left the below, so I can edit in it if necessary.
-- If you can't reproduce the problem, I will write a proper
-- repro.lua file.

-- 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/neodev.nvim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@Danielkonge Danielkonge added the bug Something isn't working label Jan 26, 2024
@wookayin
Copy link

I can't tell why this really happens, but I believe this has something to do with #158. What I found so far is neodev or lua_ls behaves differently in workspace configuration depending on which directory the language server was launched. In some dirs libraries are loaded well, in other dirs no luck.

@Danielkonge
Copy link
Author

I can't tell why this really happens, but I believe this has something to do with #158. What I found so far is neodev or lua_ls behaves differently in workspace configuration depending on which directory the language server was launched. In some dirs libraries are loaded well, in other dirs no luck.

With commit 3941036 everything works as expected, so I am pretty sure that the change in c6be05a causes problems. I haven't really looked into this though, so I am not sure what the exact problem is.

For now I am just using that commit and everything works fine (both in my after directory and my local plugin directories).

If you think this is the same issue as in #158, do you think I should just close this as a duplicate?

@wookayin
Copy link

wookayin commented Feb 1, 2024

Hmm if it's about c6be05a, maybe it is not related to #158. But I'm not quite sure as I lack understanding what's going on here --- @folke can give us a better insight.

@Danielkonge
Copy link
Author

Adding a .luarc.json in ~/.config/nvim with

{
    "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
    "runtime.version": "LuaJIT"
}

fixed my issue with newer commits.

I will leave the issue open for now, in case anyone else runs into this problem, but the problem is solved for me now (feel free to close it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants