Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about usage #573

Open
TheLazyLemur opened this issue Apr 18, 2024 · 1 comment
Open

Question about usage #573

TheLazyLemur opened this issue Apr 18, 2024 · 1 comment

Comments

@TheLazyLemur
Copy link

Hey everyone 馃憢馃徏

I have a question regarding using this lib with rg.

I have this call:

Job:new({
  command = 'rg',
  args = { '--color=never', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case', '--', 'sync' },
  cwd = '/home/dan/.config/nvim2024',
  env = { ['a'] = 'b' },
  on_exit = function(j, return_val)
    _ = j
    _ = return_val
  end,
}):sync()

However when I get it, plenary timesout after 5000ms. Even If I set it to a higher value, I still get a timeout.

Error detected while processing /home/dan/.config/nvim2024/init.lua:                                                                                                                      
E5113: Error while calling lua chunk: ...2024/site/pack/deps/opt/plenary.nvim/lua/plenary/job.lua:499: 'rg --color=never --no-heading --with-filename --line-number --column --smart-case 
-- sync' was unable to complete in 5000 ms                                                                                                                                                
stack traceback:                                                                                                                                                                          
        [C]: in function 'error'                                                                                                                                                          
        ...2024/site/pack/deps/opt/plenary.nvim/lua/plenary/job.lua:499: in function 'wait'                                                                                               
        ...2024/site/pack/deps/opt/plenary.nvim/lua/plenary/job.lua:453: in function 'sync'                                                                                               
        /home/dan/.config/nvim2024/init.lua:19: in main chunk 

I do not get this error If I use another command like fd or even ls.

Thank you 馃檹馃徏

@AlejandroSuero
Copy link
Contributor

When using rg you are searching for strings in files or files with the filename "sync", but fd and ls only are looking for files.

If I use it like:

Job:new({
  command = 'rg',
  args = { "--files" },
  cwd = os.getenv("HOME") .. '/.config/nvim',
  on_exit = function(j, return_val)
    print(vim.inspect(j:result()))
    _ = return_val
  end,
}):sync()

-- output: { "init.lua", ... }

For some reason rg it's not working when looking into the files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants