telescope-repo.nvim
telescope-repo.nvim copied to clipboard
:Telescope repo list was unsuccessful - [fd error]
The Issue
This appeared off the back of fixes deployed within the dev
branch on the commit https://github.com/cljoly/telescope-repo.nvim/commit/b7fb147317ffb706215ef142b9ef4d6d81976015 (#39)
When running the command :Telescope repo list
and then :checkhealth
, the following error is displayed
telescope._extensions.repo: require("telescope._extensions.repo.health").check()
========================================================================
- ERROR: No markdown previewer found, the extension will not work properly
- ERROR: No markdown previewer found, the extension will not work properly
- ERROR: `cached_list` will not function without locate
- OK: fd: found `fd`
fd 8.4.0
- ERROR: `:Telescope repo list` was unsuccessful. Exit code: 1
fd --hidden --case-sensitive --absolute-path --exec echo {//} ; ^\.git$
[fd error]: Command not found: Command { inner: "echo" "C:\\Users\\sgoud\\AppData\\Local\\nvim", remaining_argument_length: 8136 }
I tried to resolve this error myself and came across the following links which may be of use:
- https://github.com/sharkdp/fd/issues/735
- https://github.com/sharkdp/fd/issues/722
I tried to get a version of the command fd --hidden --case-sensitive --absolute-path --exec echo {//} ; ^\.git$
working locally but sadly could not.
Hope the above links help!
Diagnostic Information
nvim: 0.7 telescope: latest telescope-repo: 0.3.0 os: Windows 11 shell: PowerShell
Stumbled upon this comment here while looking more into it -> https://github.com/sharkdp/fd/issues/538#issuecomment-591053535
Looks like the alias echo
that's currently being used won't work within PowerShell nor will any other PowerShell-specific commands.
~~I've had some success with the following~~
~~powershell~~ ~~fd --hidden --case-sensitive --absolute-path '^\.git$' --exec powershell -Command echo `{//`}~~ ~~
~~
~~but it's awfully slow and sometimes fails on repositories that it should recognise :/~~
Update:
I've got a faster solution based on a bat script defined in the local directory which looks like
print.bat
@echo off
echo %1
with the command
fd --hidden --case-sensitive --absolute-path '^\.git$' --exec .\print.bat `{//`}
Of course, the major downside is that this is based on a script existing in the local directory and unsure how this would be integrated into the repo. However, other than using a local script, I'm not sure what other options exist for retrieving a list of all the git repositories on windows (natively)
So to clarify, you got the plugin working on Windows using your print.bat script, right?
Yup, I did indeed. I had another idea that might be better but slower? We can guarantee that the ending of each file path will be \.git\
so it might be possible to detect if the plugin is on windows and just remove the last 6 chars in lua before passing it to Telescope?
Yup, I did indeed
Great! 🎉
So to clarify, you got the plugin working on Windows using your print.bat script, right?
In that case, we can add the bat script somewhere in the sources of the plugin and use it when we detect that we are on Windows.
We can guarantee that the ending of each file path will be .git\ so it might be possible to detect if the plugin is on windows and just remove the last 6 chars in lua before passing it to Telescope?
That seems worth looking into, plus Telescope offer functions to transform input as it’s displayed if I recall correctly. Thus, we might get decent performance even on huge list of repositories.
I would have ideally raised a PR by now but haven't had the motivation to go ahead and learn Lua syntax 😅 I think trimming the chars is a better solution globally as the regex guarantees the ending of the file paths. However, I feel like there's still room for edge cases... somewhere.
There is a path module in plenary that could be of use. I'll try to take a look later, but likely in 2 weeks.
I’ve not been able to prioritize working on that yet.
any progress on this?
fd --hidden --case-sensitive --absolute-path --exec powershell /C "echo {//}" ; ^\.git$
this seems to work on windows and powershell
https://github.com/sharkdp/fd/issues/538
any progress on this?
Your PR would be a great solution! 😄
Hey 👋, been a while since this issue was raised but I think https://github.com/cljoly/telescope-repo.nvim/commit/f112878b0289f078024d477e2be2e86a3a3b0a3e means that this can be closed.
I'll close with this comment but feel free to re-open if I'm misunderstanding @cljoly