fix(find): Use full path instead of real path to avoid symlinks #368
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a respository is in a symlink-ed path (eg: larger hard-drive for projects w/ small SDD for OS), calling
nio.uv.fs_realpath
will perform symlink resolution.neotest/lua/neotest/lib/file/init.lua
Line 233 in f6048f3
Given the following scenario, nvim will run buffers with the home-dir path, instead of the resolved symlink path.
Then, the following lua code will result on 2 different filenames.
When sending the fully resolved symlinked path to a plugin, the
path_name
on the plugin will not match any of the path names of buffers, if they perform a search or use an external process.This causes issues on
rustaceanvim
LSP-based test detection, which requires the file to be on the root of the LSP runner directory, and thus, thefile_path
sent is rejected.This commit changes the login of
neotest.lib.files.path.real
to use the vim function for resolving the full path name, followed by an exists check, as there is 1 function usage that requires the error checking present.Now, the following code is the same, and resolves the
No tests found!
when running:Neotest run file
usingrustaceanvim
on a symlinked project folder (I know, niche...).