Closed jstensland closed 4 months ago
It looks like the adapter is limiting its search to the the cwd.
Perhaps it could search up to find go.mod
, go.work
or .git
to establish the root
Perhaps it could search up to find go.mod, go.work or .git to establish the root
This is actually exactly what it does today, except for making that into a root. The adapter searches for the upmost go.mod
relative to the dir/file/test you are trying to run.
I'm not sure what you are experiencing, but if you launch Neovim in the root of this very repo, you will see tests in the tests/go
folder. You can also see how there is no go.mod
in the root of this repo, but instead you will find one in the tests/go
folder.
Can you please provide a reproducible example so I can more easily see what you are seeing?
Aha, I think I got it.
The upwards search stops at the cwd
today. This behavior comes from me always opening Neovim in the root of a git repo.
https://github.com/fredrikaverpil/neotest-golang/blob/main/lua/neotest-golang/path.lua#L13
I'm not sure if it's a great idea to search further than that... 🤔
How far would you expect it to search?
To the ~/
?
I'm not 100% sure about this fix yet, but please go ahead and try it out and see if it solves the problem on your end: https://github.com/fredrikaverpil/neotest-golang/pull/104
I usually do too, so not a blocker for me, but not always.
Neotest's helper stops at HOME if I am reading this right. It looks like lspconfig just keeps searching though, so either is probably reasonable.
Matching neotest makes sense to me.
Using the changes in https://github.com/fredrikaverpil/neotest-golang/pull/104, this symptom goes away. Only tested using go.mod
fwiw
Aha, nice that you looked into those details. Many thanks. Let's go for this then. 👍
Did you check docs and existing issues?
Neovim version (nvim -v)
v0.10.0
Operating system/version
MacOS 14.5
Describe the bug
The adapter is limiting its search for the
go.mod
file to the current working directory and this is causing test commands to fail.Steps To Reproduce
go.mod
file at its root, but with packages in subdirectories.lua require("neotest").run.run( vim.fn.expand("%:h"))
. This produces a notification with the errorExpected Behavior
Tests for the package should run
Your Lua setup
No response