nvim-telescope/telescope.nvim

Grep search does not work when on windows UNC path

Zbychomir opened this issue · 0 comments

Description

When I open Neovim while being on a network path (for example, \\SERVER01\d$\directory) and try to search using Telescope's grep search, the operation fails.

[telescope] [WARN 13:38:52] C:/Users/my-user/AppData/Local/nvim-data/lazy/telescope.nvim/lua/telescope/pickers.lua:497: Finder failed with msg: .../Local/nvim-data/lazy/telescope.nvim/lua/telescope/_.lua:76: Failed to spawn process: { command = "rg", pid = "ENOENT: no such file or directory",

[...]

uv_opts = { [...] cwd = "\\\\servervm6\\d\\$\\net\\sites\\webapp}

I suspect that the problem is "d$" being split into "d" and "$", resulting in an invalid path.

Neovim version

NVIM v0.9.5
Build type: RelWithDebInfo
LuaJIT 2.1.1703942320

Operating system and version

Windows 11 Pro

Telescope version / branch / rev

telescope 0.1.x

checkhealth telescope

When starting Neovim on path C:\test:

==============================================================================
telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 14.1.0 (rev e50df40a19)
- OK fd: found fd 9.0.0

===== Installed extensions ===== ~

After changing path: :lcd \\DESKTOP-NAME\c$\test:
==============================================================================
telescope: require("telescope.health").check()

- ERROR Failed to run healthcheck for "telescope" plugin. Exception:
  function health#check, line 25
  Vim(eval):E5108: Error executing lua ...l/nvim-data/lazy/telescope.nvim/lua/telescope/health.lua:104: attempt to perform arithmetic on local 'eol' (a nil value)
  stack traceback:
  ...l/nvim-data/lazy/telescope.nvim/lua/telescope/health.lua:104: in function 'check'
  [string "luaeval()"]:1: in main chunk

Steps to reproduce

  1. nvim -nu minimal.lua
  2. :cd \\YOUR_MACHINE_NAME\c$
  3. :Telescope live_grep
  4. Type text you are looking for

Expected behavior

Display list of files containing searched text and preview of selected file in Grep Preview section.

Actual behavior

"Results" and "Grep Preview" sections are empty. Warning appears in :messages

[telescope] [WARN  15:38:23] C:/Users/myuser/AppData/Local/nvim-data/lazy/telescope.nvim/lua/telescope/pickers.lua:497: Finder failed with msg:  .../Local/nvim-data/lazy/telescope.nvim/lua/telescope/_.lua:76: Failed to spawn process: {
[telescope]   command = "rg",
[telescope]   pid = "ENOENT: no such file or directory",
[telescope]   stderr = {
[telescope]     close = <function 1>,
[telescope]     eof_rx = <function 2>,
[telescope]     eof_tx = <function 3>,
[telescope]     read_start = <function 4>,
[telescope]     start = <function 5>,
[telescope]     <metatable> = <1>{
[telescope]       __call = <function 6>,
[telescope]       __index = <table 1>,
[telescope]       __tostring = <function 7>,
[telescope]       new = <function 8>,
[telescope]       super = <2>{
[telescope]         __call = <function 6>,
[telescope]         __index = <table 2>,
[telescope]         __tostring = <function 7>,
[telescope]         close = <function 9>,
[telescope]         new = <function 10>,
[telescope]         super = <3>{
[telescope]           __call = <function 6>,
[telescope]           __index = <table 3>,
[telescope]           __tostring = <function 7>,
[telescope]           extend = <function 11>,
[telescope]           implement = <function 12>,
[telescope]           is = <function 13>,
[telescope]           new = <function 14>
[telescope]         },
[telescope]         <metatable> = <table 3>
[telescope]       },
[telescope]       <metatable> = <table 2>
[telescope]     }
[telescope]   },
[telescope]   stdin = {
[telescope]     close = <function 15>,
[telescope]     eof_rx = <function 16>,
[telescope]     eof_tx = <function 17>,
[telescope]     read_start = <function 18>,
[telescope]     start = <function 19>,
[telescope]     <metatable> = <table 1>
[telescope]   },
[telescope]   stdout = {
[telescope]     eof_rx = <function 20>,
[telescope]     eof_tx = <function 21>,
[telescope]     handle = <userdata 1>,
[telescope]     <metatable> = <4>{
[telescope]       __call = <function 6>,
[telescope]       __index = <table 4>,
[telescope]       __tostring = <function 7>,
[telescope]       iter = <function 22>,
[telescope]       new = <function 23>,
[telescope]       read = <function 24>,
[telescope]       super = <table 2>,
[telescope]       <metatable> = <table 2>
[telescope]     }
[telescope]   },
[telescope]   uv_opts = {
[telescope]     args = { "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case", "--", "tes" },
[telescope]     cwd = "\\\\DESKTOP-NAME\\c\\$",
[telescope]     stdio = {
[telescope]       [2] = <userdata 1>
[telescope]     }
[telescope]   },
[telescope]   <metatable> = <5>{
[telescope]     __index = <table 5>,
[telescope]     _for_each_pipe = <function 25>,
[telescope]     close = <function 26>,
[telescope]     new = <function 27>
[telescope]   }
[telescope] }
[telescope] stack traceback:
[telescope] ^I.../Local/nvim-data/lazy/telescope.nvim/lua/telescope/_.lua:76: in function 'spawn'
[telescope] ^I...elescope.nvim/lua/telescope/finders/async_job_finder.lua:49: in function 'finder'
[telescope] ^I.../nvim-data/lazy/telescope.nvim/lua/telescope/pickers.lua:493: in function <.../nvim-data/lazy/telescope.nvim/lua/telescope/pickers.lua:492>
[telescope] ^I[C]: in function 'pcall'
[telescope] ^I.../nvim-data/lazy/telescope.nvim/lua/telescope/pickers.lua:492: in function <.../nvim-data/lazy/telescope.nvim/lua/telescope/pickers.lua:454>

Minimal config

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  {
    'nvim-telescope/telescope.nvim',
    branch = '0.1.x',
    dependencies = {
      'nvim-lua/plenary.nvim',
      {
        'nvim-telescope/telescope-fzf-native.nvim',
        build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build',
        cond = function()
          return vim.fn.executable 'make' == 1
        end,
      },
    },
  },
}, {})