[lazy.nvim] rustaceanvim.neotest
module not found
#279
-
Neovim version (nvim -v)v0.9.5 Operating system/versionNixOS 24.05.20240306.9df3e30 Output of :checkhealth rustaceanvim=============================================================================
rustaceanvim: require("rustaceanvim.health").check()
Checking for Lua dependencies ~
- OK [mfussenegger/nvim-dap](https://github.com/mfussenegger/nvim-dap) installed.
Checking external dependencies ~
- OK rust-analyzer: found rust-analyzer 1.76.0 (07dca48 2024-02-04)
- OK Cargo: found cargo 1.76.0 (c84b36747 2024-01-18)
- OK rustc: found rustc 1.76.0 (07dca489a 2024-02-04)
- OK debug adapter: found codelldb
Checking config ~
- OK No errors found in config.
Checking for conflicting plugins ~
- ERROR lspconfig.rust_analyzer has been setup. This will likely lead to conflicts with the rustaceanvim LSP client.
Checking for tree-sitter parser ~
- OK tree-sitter parser for Rust detected. How to reproduce the issuecheck config Expected behaviourIt doesn't throw an error Actual behaviourIt throws an error Error detected while processing /home/lennylizowzskiy/.config/nvim/init.lua:
Failed to load `plugins.neotest`
/home/lennylizowzskiy/.config/nvim/lua/plugins/neotest.lua:15: module 'rustaceanvim.neotest' not found:
^Ino field package.preload['rustaceanvim.neotest']
cache_loader: module rustaceanvim.neotest not found
cache_loader_lib: module rustaceanvim.neotest not found
^Ino file '/nix/store/ms5f1k5gzv2v37yjsdvplp6lr5bk8bgg-luajit-2.1.1693350652-env/share/lua/5.1/rustaceanvim/neotest.lua'
^Ino file '/nix/store/ms5f1k5gzv2v37yjsdvplp6lr5bk8bgg-luajit-2.1.1693350652-env/share/lua/5.1/rustaceanvim/neotest/init.lua'
^Ino file '/nix/store/ms5f1k5gzv2v37yjsdvplp6lr5bk8bgg-luajit-2.1.1693350652-env/lib/lua/5.1/rustaceanvim/neotest.so'
^Ino file '/nix/store/ms5f1k5gzv2v37yjsdvplp6lr5bk8bgg-luajit-2.1.1693350652-env/lib/lua/5.1/rustaceanvim.so'
# stacktrace:
- .config/nvim/lua/plugins/neotest.lua:15
- .config/nvim/init.lua:16
Press ENTER or type command to continue The minimal config used to reproduce this issue.-- rust.lua
-- tried both with lazy = false and ft but it doesn't work anyway
return {
"mrcjkb/rustaceanvim",
lazy = false,
-- ft = { "rust" },
}
```lua
-- neotest.lua
return {
"nvim-neotest/neotest",
dependencies = {
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
"mrcjkb/rustaceanvim",
},
ft = {
"rust",
},
opts = {
adapters = {
require("rustaceanvim.neotest"),
},
},
}
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey 👋 The I believe your issue is that you are calling You should be able to work around this either by changing it to opts = function(_, opts)
opts.adapters = opts.adapters or {}
vim.list_extend(opts.adapters, {
require('rustaceanvim.neotest'),
})
end Or replace config = function()
require("neotest").setup({
adapters = {
require("rustaceanvim.neotest")
}
})
end |
Beta Was this translation helpful? Give feedback.
-
I chose the second approach and it works now. Thanks |
Beta Was this translation helpful? Give feedback.
Hey 👋
The
rustaceanvim.neotest
module definitely exists, so this is not a bug. It's an issue with how lazy.nvim loads plugins - I will convert this to a Q&A discussion.I believe your issue is that you are calling
require('rustaceanvim.neotest')
when passing it to theopts
table. So it gets called at lazy.nvim's plugin spec evaluation time (which is before it has loaded any plugins and I suppose before it overrides therequire
function to search for plugins to load).You should be able to work around this either by changing it to
Or replace
opts
with