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: requires not resolved correctly on multiple workspaces #151

Open
3 tasks done
musjj opened this issue Apr 26, 2023 · 0 comments
Open
3 tasks done

bug: requires not resolved correctly on multiple workspaces #151

musjj opened this issue Apr 26, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@musjj
Copy link

musjj commented Apr 26, 2023

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)

v0.10.0-dev-186+g191e8b406

Operating system/version

Linux

Describe the bug

Before closing this issue again, please be aware that this issue only occurs when neodev.nvim is enabled. This bug does not occur with a bare lspconfig setup.

Required modules are not resolved correctly after the second opened project and onwards. Running vim.lsp.buf.hover over a module string will not display the resolved path, but the byte length of the string. The return value of the required module, of course, is also not resolved.

Steps To Reproduce

  1. Run nvim -u init.lua
  2. Open a file from a lua project that contains some require calls.
  3. Press K over a required module string
  4. Open another file from a different lua project root
  5. Press K over a required module string
  6. Set enabled to false in neodev.nvim's plugin table
  7. Repeat step 1-5

Expected Behavior

Required modules should be resolved correctly.

Repro

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

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)

local plugins = {
  "folke/tokyonight.nvim",
  {
    "neovim/nvim-lspconfig",
    dependencies = {
      { "folke/neodev.nvim", enabled = true, config = true },
    },
    event = { "BufReadPost", "BufNewFile" },
    keys = { { "K", vim.lsp.buf.hover } },
    config = function()
      require("lspconfig").lua_ls.setup {
        settings = { Lua = { workspace = { checkThirdParty = false } } },
      }
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
@musjj musjj added the bug Something isn't working label Apr 26, 2023
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

1 participant