Closed ziontee113 closed 1 year ago
Can you please provide bug report template info? I can not reproduce
Sorry, the bug report template was overwhelming at first.
NeoVim Version
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
Describe the bug
After running nvim --clean -u minimal.lua
using the config in the bug report template, I go to this example Rust file:
#[allow(dead_code)]
fn add(a: i32, b: i32) -> i32 {
a + b
}
#[allow(dead_code)]
fn bad_add(a: i32, b: i32) -> i32 {
a - b
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_add() {
assert_eq!(add(1, 2), 3);
}
#[test]
fn test_bad_add() {
assert_eq!(bad_add(1, 2), 3);
}
}
Run :lua require("neotest").run().run()
and get the error:
E5108: Error executing lua ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../pack/packer/start/neotest/lua/neotest/consumers/run.lua:31: attempt to index u
pvalue 'client' (a nil value)
stack traceback:
[C]: in function 'error'
...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:45: in function 'step'
...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:48: in function 'execute'
...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:108: in function 'run'
.../pack/packer/start/neotest/lua/neotest/consumers/run.lua:72: in function 'run'
[string ":lua"]:1: in main chunk
After that I add neotest-rust
to the minimal.lua
file, go back to the Rust test file, run :lua require("neotest").run().run()
, it says "No Test Found". When I try :NeotestFile
and :NeotestSummary
, the tests just and doesn't work.
Logs
WARN | 2022-11-14T00:15:18Z+0700 | ...packer/start/neotest/lua/neotest/lib/treesitter/init.lua:182 | Using `build_position` or `position_id` functions with subprocess parsing is not supported, switch to using strings for remote calls
WARN | 2022-11-14T00:15:18Z+0700 | ...packer/start/neotest/lua/neotest/lib/treesitter/init.lua:182 | Using `build_position` or `position_id` functions with subprocess parsing is not supported, switch to using strings for remote calls
ERROR | 2022-11-14T00:15:18Z+0700 | ...ig/pack/packer/start/neotest/lua/neotest/client/init.lua:274 | Couldn't find positions in path /home/ziontee113/learn-rust/learn-unit-test/src/main.rs /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:26: no parser for 'rust' language, see :help treesitter-parsers
ERROR | 2022-11-14T00:15:18Z+0700 | ...ig/pack/packer/start/neotest/lua/neotest/client/init.lua:274 | Couldn't find positions in path /home/ziontee113/learn-rust/learn-unit-test/src/module.rs /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:26: no parser for 'rust' language, see :help treesitter-parsers
WARN | 2022-11-14T00:16:27Z+0700 | ...packer/start/neotest/lua/neotest/lib/treesitter/init.lua:182 | Using `build_position` or `position_id` functions with subprocess parsing is not supported, switch to using strings for remote calls
WARN | 2022-11-14T00:16:27Z+0700 | ...packer/start/neotest/lua/neotest/lib/treesitter/init.lua:182 | Using `build_position` or `position_id` functions with subprocess parsing is not supported, switch to using strings for remote calls
ERROR | 2022-11-14T00:16:27Z+0700 | ...ig/pack/packer/start/neotest/lua/neotest/client/init.lua:274 | Couldn't find positions in path /home/ziontee113/learn-rust/learn-unit-test/src/main.rs /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:26: no parser for 'rust' language, see :help treesitter-parsers
ERROR | 2022-11-14T00:16:27Z+0700 | ...ig/pack/packer/start/neotest/lua/neotest/client/init.lua:274 | Couldn't find positions in path /home/ziontee113/learn-rust/learn-unit-test/src/module.rs /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:26: no parser for 'rust' language, see :help treesitter-parsers
WARN | 2022-11-14T00:19:25Z+0700 | ...packer/start/neotest/lua/neotest/lib/treesitter/init.lua:182 | Using `build_position` or `position_id` functions with subprocess parsing is not supported, switch to using strings for remote calls
WARN | 2022-11-14T00:19:25Z+0700 | ...packer/start/neotest/lua/neotest/lib/treesitter/init.lua:182 | Using `build_position` or `position_id` functions with subprocess parsing is not supported, switch to using strings for remote calls
ERROR | 2022-11-14T00:19:25Z+0700 | ...ig/pack/packer/start/neotest/lua/neotest/client/init.lua:274 | Couldn't find positions in path /home/ziontee113/learn-rust/learn-unit-test/src/main.rs /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:26: no parser for 'rust' language, see :help treesitter-parsers
ERROR | 2022-11-14T00:19:25Z+0700 | ...ig/pack/packer/start/neotest/lua/neotest/client/init.lua:274 | Couldn't find positions in path /home/ziontee113/learn-rust/learn-unit-test/src/module.rs /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:26: no parser for 'rust' language, see :help treesitter-parsers
Additional context
I'm really confused and don't know what to do right now. It seems the minimal.lua
file lacks the directions to install Treesitter Parsers.
You can just run :TSInstall rust
using the minimal init and it should then work as expected
You can just run :TSInstall rust using the minimal init and it should then work as expected.
Yes indeed it works with the minimal config.
However, I run into issues while using null-ls
:
I set my nvim so it automatically format my file on save with null-ls
. It works just fine with the old commit from more than a week ago :thinking: With the latest version of Neotest, if I save a file after running tests, neovim just becomes unusable.
Maybe this is not a Neotest
bug but a plenary
bug? :thinking:
No it's a neotest issue, the plenary stacktrace is because the async library it provides doesn't really provide good stacktraces unfortunately.
However, I run into issues while using null-ls:
If you can add null-ls to the minimal config and reproduce, then I'll be able to use that to figure out the issue.
Also with your own config, can you set log_level = vim.log.levels.DEBUG,
in the neotest config and provide the log? The log directory can be found by running :echo stdpath("log")
. Please delete the existing log, set it to debug level, reproduce and then paste it here. It will have information about the files you're using so make sure there's nothing sensitive in them :smile:
I tried installing null-ls
in the minimal.lua
. It works find and raises no error :thinking: Although we haven't thrown nvim-lspconfig
into the mix yet :thinking:
Here's the log of my actual config, after running a test, format the file and errors like video above:
Here's the one with minimal.lua
I notice this part at the tail of my own config's log:
INFO | 2022-11-14T01:36:18Z+0700 | .../packer/start/neotest/lua/neotest/client/events/init.lua:46 | Emitting test_focused event
DEBUG | 2022-11-14T01:36:18Z+0700 | .../packer/start/neotest/lua/neotest/client/events/init.lua:48 | Calling listener summary for event test_focused
versus
INFO | 2022-11-14T01:41:18Z+0700 | ...pack/packer/start/neotest/lua/neotest/lib/subprocess.lua:66 | CHILD | Connected to parent instance
WARN | 2022-11-14T01:41:18Z+0700 | ...packer/start/neotest/lua/neotest/lib/treesitter/init.lua:182 | Using `build_position` or `position_id` functions with subprocess parsing is not supported, switch to using strings for remote calls
WARN | 2022-11-14T01:41:18Z+0700 | ...packer/start/neotest/lua/neotest/lib/treesitter/init.lua:182 | Using `build_position` or `position_id` functions with subprocess parsing is not supported, switch to using strings for remote calls
The event test_focused
looks sus to me. It seems to never stop calling :thinking:
Ah I think I see the issue
ERROR | 2022-11-14T01:36:09Z+0700 | ...te/pack/packer/start/neotest/lua/neotest/client/init.lua:274 | Couldn't find positions in path /home/ziontee113 .../pack/packer/start/neotest/lua/neotest/lib/file/find.lua:30: EACCES: permission denied: /home/ziontee113/pacman/var/cache/ldconfig
It looks like neotest-plenary is matching to your home directory which then fails during file finding because of that permission issue. Do you have a lua
directory in your home by any chance? If so could you rename it and see if the problem still exists? If that's the issue then I should be able to resolve it quite easily :smile:
OK it's resolved by removing lua
directory in my Home directory. It's just an empty folder and idk why it's there :joy:
Thank you very much @rcarriga :+1:
If that's the issue then I should be able to resolve it quite easily :smile:
I'll leave the closing of the issue to you :smile: . My issue has been resolved :partying_face:
Brilliant! I've added a fix to avoid using the home directory as a project root to avoid this in future
Hi @rcarriga , I just updated my plugins today and ran into this problem yet again. My solution is yet again revert to an older commit, in this case a2424711213bf8c0c1afe81f5ffafb34c4f2da83.
Can you provide a new log so I can confirm the cause?
@rcarriga , as I tried to reproduce the log, I updated neotest to the latest version. And it seems like everything is fine for now. I'll get back to you if I find something :+1:
NeoVim Version 0.8.0
Describe the bug After running
neotest
in Rust files, usingvim.lsp.format()
will result in error:Temporary Solution Lock
neotest
commit to 2e975ae64b0c476b72274a1d6166a22f0f01b2d5 usingpacker
.