nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.45k stars 823 forks source link

telescope can not find files with neovim installed by snap #2814

Open TioeAre opened 9 months ago

TioeAre commented 9 months ago

Description

When I use nvim installed with snap, I cannot use telescope normally. No error is reported, but all search functions cannot be used, nor can I switch the telescope version. This picture show it with nvim on path of ~/ image

Neovim version

NVIM v0.9.4
Build type: RelWithDebInfo
LuaJIT 2.1.1692716794
Compilation: /usr/bin/cc -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/build/nvim/parts/nvim/build/.deps/usr/include/luajit-2.1 -I/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/build/src/nvim/auto -I/build/nvim/parts/nvim/build/build/include -I/build/nvim/parts/nvim/build/build/cmake.config -I/build/nvim/parts/nvim/build/src -I/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Operating system and version

ubuntu 20.04

Telescope version / branch / rev

telescope 0.1.5

checkhealth telescope

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

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

Checking external dependencies ~
- OK rg: found ripgrep 12.1.0 (rev 1980630f17)
- OK fd: found fd 7.4.0

===== Installed extensions =====

Steps to reproduce

  1. use sudo snap install nvim --classic and use lazy.nvim to install telescope with ~/.config/nvim/lua/plugins/telescope.lua like this
    
    vim.g.mapleader = " "
    vim.g.maplocalleader = " "

local keymap = vim.keymap

local config = function() local telescope = require('telescope') telescope.setup({ defaults = { mappings = { i = { [''] = 'move_selection_next', [''] = 'move_selection_previous' } } }, pickers = { find_files = { theme = 'dropdown', previewer = false -- hidden = true }, live_grep = { theme = 'dropdown', previewer = false }, find_buffers = { theme = 'dropdown', previewer = false } } }) end

return { 'nvim-telescope/telescope.nvim', -- lazy = false, tag = '0.1.5', dependencies = {'nvim-lua/plenary.nvim', 'nvim-treesitter/nvim-treesitter'}, cmd = "Telescope", config = config, defaults = { file_ignore_patterns = {'node_modules', '.git'} }, keys = { { "ff", ":Telescope find_files", desc = "find files" }, { "fs", ":Telescope grep_string", desc = "grep string" }, { "fg", ":Telescope live_grep", desc = "live grep string" }, { "fr", ":Telescope resume", desc = "resume last search window" }} }

2. open `nvim .` and use `space+ff` to call telescope find files

### Expected behavior

_No response_

### Actual behavior

![image](https://github.com/nvim-telescope/telescope.nvim/assets/89766446/867ac925-df34-40e8-87cb-094a58abd761)

### Minimal config

```Lua
vim.g.mapleader = " "
vim.g.maplocalleader = " "

local keymap = vim.keymap

local config = function()
    local telescope = require('telescope')
    telescope.setup({
        defaults = {
            mappings = {
                i = {
                    ['<C-j>'] = 'move_selection_next',
                    ['<C-k>'] = 'move_selection_previous'
                }
            }
        },
        pickers = {
            find_files = {
                theme = 'dropdown',
                previewer = false
                -- hidden = true
            },
            live_grep = {
                theme = 'dropdown',
                previewer = false
            },
            find_buffers = {
                theme = 'dropdown',
                previewer = false
            }
        }
    })
end

return {
    'nvim-telescope/telescope.nvim',
    -- lazy = false,
    tag = '0.1.5',
    dependencies = {'nvim-lua/plenary.nvim', 'nvim-treesitter/nvim-treesitter'},
    cmd = "Telescope",
    config = config,
    defaults = {
        file_ignore_patterns = {'node_modules', '.git'}
    },
    keys = {
    {
        "<leader>ff",
        ":Telescope find_files<cr>",
        desc = "find files"
    }, {
        "<leader>fs",
        ":Telescope grep_string<cr>",
        desc = "grep string"
    }, {
        "<leader>fg",
        ":Telescope live_grep<cr>",
        desc = "live grep string"
    }, {
        "<leader>fr",
        ":Telescope resume<cr>",
        desc = "resume last search window"
    }}
}
jamestrew commented 9 months ago

Did you install ripgrep/fd using snap as well? If so, there's some privilege confinement rules that won't let those tools function properly within neovim.

TioeAre commented 9 months ago

no, I installed fd and ripgrep by apt . Should I increase the permissions of someone? Thank you very much.

Did you install ripgrep/fd using snap as well? If so, there's some privilege confinement rules that won't let those tools function properly within neovim.

jamestrew commented 9 months ago

Maybe neovim being installed via snap causes the issue as well. I'm far from an expert on snap but I don't think it's a permissions issue. I think it's the way snap installs and compiles programs. I think you can install it with flags to relax the confinement. I'm not entirely sure.

I would try using neovim's appimage to first see if the snap installation of neovim is the issue. We can continue from there.

TioeAre commented 9 months ago

Maybe neovim being installed via snap causes the issue as well. I'm far from an expert on snap but I don't think it's a permissions issue. I think it's the way snap installs and compiles programs. I think you can install it with flags to relax the confinement. I'm not entirely sure.

I would try using neovim's appimage to first see if the snap installation of neovim is the issue. We can continue from there.

I have found that telescope works well in the appImage version of nvim (from gitHub release), but I am still unsure why it is not functioning properly in the nvim installed via snap. So far, it seems that other plugins do not have this issue. I hope to draw the developers' attention to this matter. Thanks very much.

jamestrew commented 8 months ago

Thanks for confirming. I'm not sure why either. I'll leave this issue open until we can find a valid reason or fix.

aminerwx commented 8 months ago

I had same issue #2858 on archlinux, try to uninstall fd and ripgrep from your machine.

TioeAre commented 8 months ago

@aminerwx thanks for you recommend, but I am not sure if it is fd/ripgrep causes my problem, I have tried to Appimage instead of snap, and it works well, and there is just one version of fd/ripgrep in my machine installed by apt, The problem seems to become that neovim installed by Appimage can use fd/ripgrep installed by apt, but calling telescope in neovim installed by snap does not work properly. However, others such as lsp and treesitter can still work normally.

Maybe neovim being installed via snap causes the issue as well. I'm far from an expert on snap but I don't think it's a permissions issue. I think it's the way snap installs and compiles programs. I think you can install it with flags to relax the confinement. I'm not entirely sure. I would try using neovim's appimage to first see if the snap installation of neovim is the issue. We can continue from there.

I have found that telescope works well in the appImage version of nvim (from gitHub release), but I am still unsure why it is not functioning properly in the nvim installed via snap. So far, it seems that other plugins do not have this issue. I hope to draw the developers' attention to this matter. Thanks very much.

tarunaksha commented 7 months ago

I am facing the same issue as well. The :checkhealth telescope command is showing all OK. But grep_find and file_preview are not working. I perform all the instructions from the official docs and also checked all the forums but the issue isn't resolving. Please fix this. I also installed nvim from snap store. The apt package manage should update the softwares, I had to use snap all the time because of the latest versions available but it creates problem all the time with the sudo and the user preferences.

tarunaksha commented 7 months ago

FOUND MY SOLUTION

I checked in my machine the apt couldn't recognize the ripgrep. So I removed the ripgrep using sudo snap command, then installed it again with apt-get command. Now the grep and file preview is working fine. I suggest installing the ripgrep from apt-get. Dont install it from snap store.