danielfalk / smart-open.nvim

Neovim plugin for fast file-finding
MIT License
498 stars 25 forks source link

Picker entry containing raw "ls" command output appears in 0.2.x #72

Open ebkalderon opened 3 months ago

ebkalderon commented 3 months ago

At the time of writing, the 0.2.x branch of smart-open.nvim produces a strange "phantom" entry, with an empty filename, seemingly containing raw ls command output. See the screenshot below: Screenshot from 2024-06-14 21-13-59 This weird entry appears in the Telescope entry regardless of the CWD. I can confirm that switching back to the 0.1.x branch of smart-open.nvim makes it magically go away, which means this bug is likely specific to the 0.2.x branch.

Below is the lazy.nvim configuration I used to configure telescope.nvim and smart-open.nvim:

Click to reveal full config ```lua 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", lazypath, }) end vim.opt.rtp:prepend(lazypath) require('lazy').setup({ { "nvim-telescope/telescope.nvim", event = "VimEnter", dependencies = { "nvim-lua/plenary.nvim", { "nvim-telescope/telescope-fzf-native.nvim", build = "make", cond = function() return vim.fn.executable("make") == 1 end, }, { "danielfalk/smart-open.nvim", branch = "0.2.x", dependencies = { "kkharji/sqlite.lua" }, config = true, }, { "nvim-telescope/telescope-ui-select.nvim" }, { "nvim-tree/nvim-web-devicons" }, }, config = function() require("telescope").setup({ defaults = { file_ignore_patterns = { ".git/", "node_modules/", "target/", "%.gif", "%.jpeg", "%.jpg", "%.png", }, }, extensions = { smart_open = { match_algorithm = "fzf", }, ["ui-select"] = { require("telescope.themes").get_dropdown(), }, }, }) pcall(require("telescope").load_extension, "fzf") pcall(require("telescope").load_extension, "smart_open") pcall(require("telescope").load_extension, "ui-select") local builtin = require("telescope.builtin") vim.keymap.set("n", "sh", builtin.help_tags, { desc = "[S]earch [h]elp" }) vim.keymap.set("n", "sH", builtin.highlights, { desc = "[S]earch [H]ighlight Groups" }) vim.keymap.set("n", "sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" }) vim.keymap.set("n", "sf", builtin.find_files, { desc = "[S]earch [F]iles" }) vim.keymap.set("n", "ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" }) vim.keymap.set("n", "sw", builtin.grep_string, { desc = "[S]earch current [W]ord" }) vim.keymap.set("n", "sg", builtin.live_grep, { desc = "[S]earch by [G]rep" }) vim.keymap.set("n", "sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" }) vim.keymap.set("n", "sr", builtin.resume, { desc = "[S]earch [R]esume" }) vim.keymap.set("n", "s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set("n", "", builtin.buffers, { desc = "[ ] Find existing buffers" }) end, }, }) ```

To reproduce the screenshot above, try running the following command in Neovim:

:Telescope smart_open cwd_only=true theme=dropdown

Similar results can be seen if you use the Lua API to launch the picker.

wiseodd commented 2 months ago

I believe this commit fixes the issue: https://github.com/danielfalk/smart-open.nvim/commit/99ea9c3cfc407d25204147dae93520ab6acc39a5

It's still only in the main and 0.1 branches, though.