Open gbroques opened 9 months ago
Probably this is because of vim.fs
module's implementation. It cannot detect Windows file paths (including \
) validly.
After #156, this plugin takes more priority to use rg
/ fd
executable than vim.fs
module to show entries. Can you test the latest master after installing rg
/ fd
?
Probably this is because of
vim.fs
module's implementation. It cannot detect Windows file paths (including\
) validly.After #156, this plugin takes more priority to use
rg
/fd
executable thanvim.fs
module to show entries. Can you test the latest master after installingrg
/fd
?
Thank you for the reply @delphinus! :)
I updated to the latest commit 9c18474d0a4b82435ce141c2a21d9bd7b9189272, and I do have rg
and fd
installed.
Unfortunately it still doesn't work.
The behavior is slightly different now:
nvim
in a project directory.:Telescope frecency
:Telescope frecency
.[telescope] [WARN 21:23:10] C:/Users/{Username}/AppData/Local/nvim-data/lazy/telescope.nvim/lua/telescope/pickers.lua:493: Finder failed with msg: .../nvim-data/lazy/telescope.nvim/lua/telescope/pickers.lua:1149: E5560: nvim_buf_is_valid must not be called in a lua loop callback
Probably this is because of
vim.fs
module's implementation. It cannot detect Windows file paths (including\
) validly.After #156, this plugin takes more priority to use
rg
/fd
executable thanvim.fs
module to show entries. Can you test the latest master after installingrg
/fd
?
If you need me to add some print
debug statements somewhere in the code to help troubleshoot this, then let me know!
I can report the output I see in this thread.
@gbroques Thank you for further info!
It seems that rg
cannot return any entry and telescope looks stuck. Please run Neovim with env variable: DEBUG_PLENARY=1
. Such as,
$ export DEBUG_PLENARY=1
$ nvim
# and run :Telescope frecency
Then :mes
shows debugging logs by frecency. Paste them here like below.
[plenary] [DEBUG 13:32:16] ……/database/native/watcher.lua:76: watch path: /Users/jinnouchi.yasushi/.local/share/nvim/file_frecency.bin
[plenary] [DEBUG 13:32:18] ……/database/native/watcher.lua:84: update mtime: 0.0 -> 1705465720.942600799
[plenary] [DEBUG 13:32:18] ……/database/native.lua:172: load() takes 0.001189 seconds
[plenary] [DEBUG 13:32:19] ……/database/native/watcher.lua:76: watch path: /Users/jinnouchi.yasushi/.local/share/nvim/file_frecency.bin
[plenary] [DEBUG 13:32:20] ……/database/native/watcher.lua:84: update mtime: 1705465720.942600799 -> 1705465720.942600799
[plenary] [DEBUG 13:32:20] ……/database/native.lua:172: load() takes 0.001060 seconds
[plenary] [DEBUG 13:32:20] ……/frecency.lua:130: Frecency:start
[plenary] [DEBUG 13:32:20] ……/picker.lua:102: {
[plenary] workspace = "/Users/jinnouchi.yasushi"
[plenary] }
[plenary] [DEBUG 13:32:20] ……/finder.lua:82: scan_dir_cmd: { "rg", "-.g", "!.git", "--files" }
[plenary] [DEBUG 13:32:20] ……/frecency.lua:145: Frecency:start picker:start takes 0.022498 seconds
[plenary] [DEBUG 13:32:20] ……/finder.lua:252: {
[plenary] workspace = "/Users/jinnouchi.yasushi"
[plenary] }
[plenary] [DEBUG 13:32:20] ……/finder.lua:255: it takes 0.001504 seconds in fetching entries
[plenary] [DEBUG 13:32:20] ……/finder.lua:264: it takes 0.000276 seconds in calculating recency
[plenary] [DEBUG 13:32:20] ……/finder.lua:265: it takes 0.000661 seconds in making results
[plenary] [DEBUG 13:32:20] ……/finder.lua:271: it takes 0.000098 seconds in sorting
(I have cut some long paths in logs)
Please run Neovim with env variable:
DEBUG_PLENARY=1
.
Thanks for posting these instructions @delphinus! That's a really good debugging tip.
Also, I realized the behavior is inconsistent and I see the following two scenarios:
:Telescope frecency
.Additionally, I ran :lua print(vim.o.shell)
and it's cmd.exe
.
I set the DEBUG_PLENARY
environment variable to 1
, ran nvim
, and then :Telescope frecency
.
The following is the output for :Telescope frecency
during scenario 1.:
[plenary] [DEBUG 20:49:25] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/database/native/watcher.lua:76: watch path: C:\Users\gbroques\AppData\Local\nvim-data\file_frecency.bin
[plenary] [DEBUG 20:49:25] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/database/native/watcher.lua:84: update mtime: 0.0 -> 1705464139.469617900
[plenary] [DEBUG 20:49:25] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/database/native.lua:172: load() takes 0.009000 seconds
[plenary] [DEBUG 20:49:25] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/database/native/watcher.lua:76: watch path: C:\Users\gbroques\AppData\Local\nvim-data\file_frecency.bin
[plenary] [DEBUG 20:49:25] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/database/native/watcher.lua:84: update mtime: 1705464139.469617900 -> 1705464139.469617900
[plenary] [DEBUG 20:49:25] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/database/native.lua:172: load() takes 0.005000 seconds
[plenary] [DEBUG 20:49:26] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/frecency.lua:130: Frecency:start
[plenary] [DEBUG 20:49:26] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/picker.lua:102: {
[plenary] workspace = "C:\\Users\\Public\\Projects\\telescope-frecency.nvim"
[plenary] }
[plenary] [DEBUG 20:49:26] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:140: {
[plenary] args = { "-.g", "!.git", "--files" },
[plenary] cmd = "rg"
[plenary] }
[plenary] [DEBUG 20:49:26] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:82: scan_dir_cmd: { "rg", "-.g", "!.git", "--files" }
[plenary] [DEBUG 20:49:26] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/frecency.lua:145: Frecency:start picker:start takes 0.103000 seconds
[plenary] [DEBUG 20:49:26] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:252: {
[plenary] workspace = "C:\\Users\\Public\\Projects\\telescope-frecency.nvim"
[plenary] }
[plenary] [DEBUG 20:49:26] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:255: it takes 0.001000 seconds in fetching entries
[plenary] [DEBUG 20:49:26] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:264: it takes 0.000000 seconds in calculating recency
[plenary] [DEBUG 20:49:26] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:265: it takes 0.004000 seconds in making results
[plenary] [DEBUG 20:49:26] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:271: it takes 0.000000 seconds in sorting
[plenary] [DEBUG 20:49:33] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/frecency.lua:130: Frecency:start
[plenary] [DEBUG 20:49:33] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/picker.lua:102: {
[plenary] workspace = "C:\\Users\\Public\\Projects\\telescope-frecency.nvim"
[plenary] }
[plenary] [DEBUG 20:49:33] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:140: {
[plenary] args = { "-.g", "!.git", "--files" },
[plenary] cmd = "rg"
[plenary] }
[plenary] [DEBUG 20:49:33] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:82: scan_dir_cmd: { "rg", "-.g", "!.git", "--files" }
[plenary] [DEBUG 20:49:33] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/frecency.lua:145: Frecency:start picker:start takes 0.101000 seconds
[plenary] [DEBUG 20:49:33] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:252: {
[plenary] workspace = "C:\\Users\\Public\\Projects\\telescope-frecency.nvim"
[plenary] }
[plenary] [DEBUG 20:49:33] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:255: it takes 0.000000 seconds in fetching entries
[plenary] [DEBUG 20:49:33] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:264: it takes 0.000000 seconds in calculating recency
[plenary] [DEBUG 20:49:33] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:265: it takes 0.005000 seconds in making results
[plenary] [DEBUG 20:49:33] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:271: it takes 0.000000 seconds in sorting
[telescope] [WARN 20:49:34] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope.nvim/lua/telescope/pickers.lua:493: Finder failed with msg: .../nvim-data/lazy/telescope.nvim/lua/telescope/pickers.lua:1149: E5560: nvim_buf_is_valid must not be called in a lua loop callback
Here is the output for :Telescope frecency
during scenario 2.:
[plenary] [DEBUG 20:58:21] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/database/native/watcher.lua:76: watch path: C:\Users\gbroques\AppData\Local\nvim-data\file_frecency.bin
[plenary] [DEBUG 20:58:21] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/database/native/watcher.lua:84: update mtime: 0.0 -> 1705464139.469617900
[plenary] [DEBUG 20:58:21] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/database/native.lua:172: load() takes 0.006000 seconds
[plenary] [DEBUG 20:58:21] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/database/native/watcher.lua:76: watch path: C:\Users\gbroques\AppData\Local\nvim-data\file_frecency.bin
[plenary] [DEBUG 20:58:21] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/database/native/watcher.lua:84: update mtime: 1705464139.469617900 -> 1705464139.469617900
[plenary] [DEBUG 20:58:21] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/database/native.lua:172: load() takes 0.004000 seconds
[plenary] [DEBUG 20:58:22] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/frecency.lua:130: Frecency:start
[plenary] [DEBUG 20:58:22] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/picker.lua:102: {
[plenary] workspace = "C:\\Users\\Public\\Projects\\telescope-frecency.nvim"
[plenary] }
[plenary] [DEBUG 20:58:22] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:140: {
[plenary] args = { "-.g", "!.git", "--files" },
[plenary] cmd = "rg"
[plenary] }
[plenary] [DEBUG 20:58:22] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:82: scan_dir_cmd: { "rg", "-.g", "!.git", "--files" }
[plenary] [DEBUG 20:58:22] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/frecency.lua:145: Frecency:start picker:start takes 0.090000 seconds
[plenary] [DEBUG 20:58:22] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:252: {
[plenary] workspace = "C:\\Users\\Public\\Projects\\telescope-frecency.nvim"
[plenary] }
[plenary] [DEBUG 20:58:22] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:255: it takes 0.000000 seconds in fetching entries
[plenary] [DEBUG 20:58:22] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:264: it takes 0.000000 seconds in calculating recency
[plenary] [DEBUG 20:58:22] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:265: it takes 0.002000 seconds in making results
[plenary] [DEBUG 20:58:22] C:/Users/gbroques/AppData/Local/nvim-data/lazy/telescope-frecency.nvim/lua/frecency/finder.lua:271: it takes 0.000000 seconds in sorting
I found problems in vim.fs.joinpath
& vim.fs.dir
that they does not think Windows over. Maybe #168 fix this issue. Still testing……
I found problems in
vim.fs.joinpath
&vim.fs.dir
that they does not think Windows over. Maybe #168 fix this issue. Still testing……
Thank you @delphinus!
I checked out that branch, and tested it.
Some of the paths are fixed, but I see duplicates of some paths which still display incorrectly with the "C:\Users.." in the front (see below screenshots).
Also, I deleted the file_frecency.bin
file to try and remove any old paths.
Lastly, I'm still seeing the behavior where the picker occassionaly fails to populate until I type a character, and I see a " E5560: nvim_buf_is_valid must not be called in a lua loop callback" warning.
I found a problem for logic for importing entries at the first launch.
If file_frecency.bin
does not exist, this plugin imports entries from v:oldfiles
. If v:oldfiles
contains duplicated entries such as both c:\foo\bar.txt
and c:/foo/bar.txt
, it also imports them and you will see matched both entries in query.
We should improve this by detecting duplication of paths. I will try it.
But another problem. E5560: nvim_buf_is_valid must not be called in a lua loop callback
cannot be seen in my env. I've prepared env on Windows with this minimal init.lua
.
vim.opt.runtimepath:prepend [[\Users\jinnouchi.yasushi\AppData\Local\nvim-data\lazy\telescope.nvim]]
vim.opt.runtimepath:prepend [[\Users\jinnouchi.yasushi\AppData\Local\nvim-data\lazy\telescope-frecency.nvim]]
vim.opt.runtimepath:prepend [[\Users\jinnouchi.yasushi\AppData\Local\nvim-data\lazy\plenary.nvim]]
vim.keymap.set("n", "<Leader>ff", "<Cmd>Telescope frecency workspace=CWD<CR>")
vim.keymap.set("n", "<Leader>fo", "<Cmd>Telescope frecency<CR>")
require("telescope").setup {}
vim.fn.chdir [[\Users\jinnouchi.yasushi\AppData\Local\nvim-data\lazy\telescope-frecency.nvim]]
-- vim:se ts=2 sts=2 sw=2 et:
And :Telescope frecency workspace=CWD
does not show such warnings. Can you show your settings for telescope?
Ah, you're using Cygwin! I did this in plain Windows. I will also setup Cygwin and try the same one.
I found a problem for logic for importing entries at the first launch.
If
file_frecency.bin
does not exist, this plugin imports entries fromv:oldfiles
. Ifv:oldfiles
contains duplicated entries such as bothc:\foo\bar.txt
andc:/foo/bar.txt
, it also imports them and you will see matched both entries in query.We should improve this by detecting duplication of paths. I will try it.
Ok, that makes sense.
I'll clear my v:oldfiles
by editing $XDG_DATA_HOME/nvim/shada/main.shada
as instructed in this thread, and see if I can remove the duplicate bad paths manually.
Can you show your settings for telescope?
Sure thing!
The following should be my complete telescope configuration: https://github.com/gbroques/neovim-configuration/blob/53272b8a09c2c905cdb2f3802d9ffd1aff6827ef/lua/plugins/fuzzy-finder.lua#L2-L115
Currently, I'm pinned to a telescope commit, 2ea8dc, from 6 months ago. I can try updating to the latest commit on master
.
Let me know if you need any other help to reproduce this, or have questions.
Thanks again for all your support in solving these issues!
I see. Your setup seems to have no mistake.
I can try updating to the latest commit on master.
Yes. This can help you, maybe.
I can try updating to the latest commit on master.
Yes. This can help you, maybe.
I updated my telescope plugin to the latest commit on master
, 36dce626, and see the same behavior.
The following is my nvim --version
output, if it helps:
$ nvim --version
NVIM v0.9.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe /MD /Zi /
O2 /Ob1 -W3 -wd4311 -wd4146 -DUNIT_TESTING -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0602 -DMSWIN -DINCL
UDE_GENERATED_DECLARATIONS -ID:/a/neovim/neovim/.deps/usr/include/luajit-2.1 -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neov
im/.deps/usr/include -ID:/a/neovim/neovim/build/src/nvim/auto -ID:/a/neovim/neovim/build/include -ID:/a/neovim/neovim/build/cmake.conf
ig -ID:/a/neovim/neovim/src -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/u
sr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a
/neovim/neovim/.deps/usr/include
system vimrc file: "$VIM\sysinit.vim"
fall-back for $VIM: "C:/Program Files (x86)/nvim/share/nvim"
Run :checkhealth for more info
@gbroques I did changes in #168 and fixed almost all of bugs in using Windows.
But I found one problem: #170. This is due to the logic of plenary.nvim, that is needed by telescope.nvim itself. I think this cannot be solved with simple way...
And I also tried v0.9.0. But again I could not see E5560: nvim_buf_is_valid must not be called in a lua loop callback
. Can you try with minimal init.lua such as I described in this comment?
I merged #168. From now, please check behavior in the latest master.
Filepaths are not displayed correcty in the picker (see below
:Telescope frecency
screenshot ), and sometimes when I select a file an empty buffer opens instead.I haven't been able to reproduce the latter behavior consistently though, but I suspect it's related.
I expect to see filepaths displayed as
:Telescope find_files
displays them (see below screenshot).Steps to Reproduce
telescope-frecency.nvim
in/cygdrive/c/Users/Public/Projects
.telescope-frecency.nvim
directory.:Telescope frecency
.The following is a link to my Telescope configuration: https://github.com/gbroques/neovim-configuration/blob/919ffbd07538ab432c6eba088c3330793e10b6ad/lua/plugins/fuzzy-finder.lua#L62-L113
I'm currently pinned to commit de410701811f4142315ce89183256a969a08ff9d which is from early December.