nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

find_file picker not working properly anymore

jacobrreed opened this issue · comments

Description

Since latest update it seems the find file picker is not working properly, a lot of matches aren't showing, and if i start typing a filename i can see the file I want, but if i continue to type the full filename results dont show the file until i type it all out, i.e in the middle of searching

Neovim version

NVIM v0.10.0-dev-2958+g18da6964c-Homebrew
Build type: Release
LuaJIT 2.1.1713517273

Operating system and version

MacOS 14.4.1

Telescope version / branch / rev

0.1.5 master

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 14.1.0
- OK fd: found fd 9.0.0

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

Telescope Extension: `aerial` ~
- No healthcheck provided

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Telescope Extension: `live_grep_args` ~
- No healthcheck provided

Telescope Extension: `noice` ~
- No healthcheck provided

Telescope Extension: `undo` ~
- No healthcheck provided

Steps to reproduce

  1. Start neovim
  2. Open telescope find_files picker
  3. Start typing a filename, see that file in the result, but continue to type the full name slowly, it will disappear then (maybe) reappear after you type entire filename in

Expected behavior

I should be able to see the file(s) that match pattern entire time as long as pattern matches

Actual behavior

telescope.bug.mov

Minimal config

require("config.keymap")

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not 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",
		cond = not vim.g.vscode,
		tag = "0.1.5",
		lazy = false,
		dependencies = {
			"nvim-lua/plenary.nvim",
			"nvim-telescope/telescope-live-grep-args.nvim",
			{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
			"nvim-tree/nvim-web-devicons",
			"debugloop/telescope-undo.nvim",
		},
		config = function()
			local telescope = require("telescope")
			local actions = require("telescope.actions")

			vim.api.nvim_create_autocmd("FileType", {
				pattern = "TelescopeResults",
				callback = function(ctx)
					vim.api.nvim_buf_call(ctx.buf, function()
						vim.fn.matchadd("TelescopeParent", "\t\t.*$")
						vim.api.nvim_set_hl(0, "TelescopeParent", { link = "Comment" })
					end)
				end,
			})

			local select_one_or_multi = function(prompt_bufnr)
				local picker = require("telescope.actions.state").get_current_picker(prompt_bufnr)
				local multi = picker:get_multi_selection()
				if not vim.tbl_isempty(multi) then
					require("telescope.actions").close(prompt_bufnr)
					for _, j in pairs(multi) do
						if j.path ~= nil then
							vim.cmd(string.format("%s %s", "edit", j.path))
						end
					end
				else
					require("telescope.actions").select_default(prompt_bufnr)
				end
			end

			local smart_send_and_open_qflist = function(prompt_bufnr)
				require("telescope.actions").smart_send_to_qflist(prompt_bufnr)
				require("telescope.actions").open_qflist(prompt_bufnr)
				vim.g.qf_is_open = true
			end

			telescope.setup({
				defaults = {
					history = {
						path = vim.fn.stdpath("data") .. "/telescope_history.sqlite",
						limit = 100,
					},
					layout_config = { horizontal = { height = 0.90, width = 0.90, preview_width = 0.4 } },
					layout_strategy = "horizontal",
					sorting_strategy = "ascending",
					path_display = function(_, path)
						local tail = vim.fs.basename(path)
						local parent = vim.fs.dirname(path)
						if parent == "." then
							return tail
						end
						return string.format("%s\t\t%s", tail, parent)
					end,
					winblend = 0,
					color_devicons = true,
					mappings = {
						i = {
							["<C-k>"] = actions.move_selection_previous,
							["<C-j>"] = actions.move_selection_next,
							["<C-q>"] = smart_send_and_open_qflist,
							["<C-u>"] = actions.preview_scrolling_up,
							["<C-d>"] = actions.preview_scrolling_down,
							["<RightMouse>"] = actions.close,
							["<LeftMouse>"] = actions.select_default,
							["<ScrollWheelDown>"] = actions.move_selection_next,
							["<ScrollWheelUp>"] = actions.move_selection_previous,
							["<CR>"] = select_one_or_multi,
						},
					},
					extensions = {
						live_grep_args = {
							auto_quoting = true,
						},
						undo = {
							mappings = {
								["<cr>"] = require("telescope-undo.actions").restore,
							},
						},
					},
				},
			})
			telescope.load_extension("fzf")
			telescope.load_extension("live_grep_args")
			telescope.load_extension("undo")
		end,
		keys = function()
			local live_grep_args_shortcuts = require("telescope-live-grep-args.shortcuts")
			return {
				{
					"<leader>tf",
					"<cmd>Telescope find_files<cr>",
					desc = "Find files",
				},
				{
					"<leader><leader>",
					"<cmd>Telescope find_files<cr>",
					desc = "Find files",
				},
				{
					"<leader>tF",
					"<cmd>Telescope find_files find_command=rg,--files,--hidden,--no-ignore-vcs,-g,!**/.git/*,-g,!**/node_modules/*<cr>",
					desc = "Find files (ALL)",
				},
				{
					"<leader>tH",
					":lua require('telescope.builtin').highlights()<cr>",
					desc = "Highlights",
				},
				{
					"<leader>th",
					":lua require('telescope.builtin').help_tags()<cr>",
					desc = "Help",
				},
				{ "<leader>tb", "<cmd>Telescope buffers<cr>", desc = "Find buffers" },
				{
					"<leader>t/",
					":lua require('telescope').extensions.live_grep_args.live_grep_args()<cr>",
					desc = "Live grep",
				},
				{
					"<leader>/",
					":lua require('telescope').extensions.live_grep_args.live_grep_args()<cr>",
					desc = "Live grep",
				},
				{
					"<leader>/",
					live_grep_args_shortcuts.grep_visual_selection,
					mode = "v",
					desc = "Live grep (visual)",
				},
				{ "<leader>tg", "<cmd>Telescope git_files<cr>", desc = "Git file list" },
				{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command history" },
				{ "<leader>t:", "<cmd>Telescope command_history<cr>", desc = "Command history" },
				{ "<leader>?", "<cmd>Telescope search_history<cr>", desc = "Search history" },
				{ "<leader>t?", "<cmd>Telescope search_history<cr>", desc = "Search history" },
				{ "<leader>tC", ":lua require('telescope.builtin').colorscheme()<cr>", desc = "Color schemes" },
				{ "<leader>tq", "<cmd>Telescope quickfix<cr>", desc = "Quickfix list" },
				{ "<leader>tR", "<cmd>Telescope registers<cr>", desc = "Registers" },
				{ "<leader>to", "<cmd>Telescope oldfiles<cr>", desc = "Recent files" },
				{ "<leader>tu", "<cmd>Telescope undo<cr>", desc = "Undo history" },
				{ "<leader>tr", "<cmd>Telescope resume<cr>", desc = "Telescope resume" },
				{ "<leader>ta", "<cmd>Telescope aerial<cr>", desc = "Telescope Aerial (code outline)" },
			}
		end,
	},
}, {})

require("config")

nvm i'm dumb, i was using 0.1.5, seems to be fine in 0.1.6, didnt realize i had version pinned

Nevermind, i'm still seeing this in latest intermittently

I believe this is an issue with interactions between nightly neovim and telescope.
It was fixed in this PR #2986

Can you try the master branch?

I believe this is an issue with interactions between nightly neovim and telescope. It was fixed in this PR #2986

Can you try the master branch?

Ya this seems fixed in master so I guess ill just use master for now even though README says. its not recommended

Maybe "not recommended" is a little strong and depends on tolerance and comfort level to bugs/breaking changes, etc.
But if you're comfortable with using nightly neovim, nightly (or pinned nightly) telescope shouldn't be too bad.
Or alternatively you could downgrade to stable neovim and stay on stable telescope.

Thanks

Maybe "not recommended" is a little strong and depends on tolerance and comfort level to bugs/breaking changes, etc. But if you're comfortable with using nightly neovim, nightly (or pinned nightly) telescope shouldn't be too bad. Or alternatively you could downgrade to stable neovim and stay on stable telescope.

Thanks

ya thats fine with me haha, ill use master