nvim-telescope / telescope.nvim

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

Picker's refresh doesn't work #2396

Closed 3Xpl0it3r closed 1 year ago

3Xpl0it3r commented 1 year ago

Description

&esmp;Call Packer:refresh cannot refresh results in finder; Expect: display "a,b,c" after `picker:fresh(picker.finer, {}) Actual: display "1,2" example code blow:

local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local sorters = require("telescope.sorters")

-- 创建一个简单的 finder,返回一些示例数据
local example_finder = finders.new_table({
        results = { "1", "2" },
})

-- 创建选择器
local picker = pickers.new({}, {
        prompt_title = "Example Picker",
        finder = example_finder,
        sorter = sorters.get_generic_fuzzy_sorter(),
})

-- 渲染 Picker

picker:find()
-- 替换 finder 中的结果
picker.finder.results = { "a", "b", "c" }

-- 刷新 Picker,并重新渲染
picker:refresh(picker.finder, {})

Neovim version

NVIM v0.8.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Big-Sur

Features: +acl +iconv +tui
See ":help feature-compile"

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

Run :checkhealth for more info

Operating system and version

macOs 11.6.1

Telescope version / branch / rev

telescope master

checkhealth telescope

telescope: require("telescope.health").check()
    2 ========================================================================
    3 ## Checking for required plugins
    4   - OK: plenary installed.
    5   - OK: nvim-treesitter installed.
    6
    7 ## Checking external dependencies
    8   - OK: rg: found ripgrep 13.0.0
    9   - OK: fd: found fd 8.6.0
   10
   11 ## ===== Installed extensions =====
   12
   13 ## Telescope Extension: `aerial`
   14   - INFO: No healthcheck provided
   15
   16 ## Telescope Extension: `fzf`
   17   - OK: lib working as expected
   18   - OK: file_sorter correctly configured
   19   - OK: generic_sorter correctly configured

Steps to reproduce

  1. vim demo.lua
  2. code blow:
    
    local pickers = require("telescope.pickers")
    local finders = require("telescope.finders")
    local sorters = require("telescope.sorters")

-- 创建一个简单的 finder,返回一些示例数据 local example_finder = finders.new_table({ results = { "1", "2" }, })

-- 创建选择器 local picker = pickers.new({}, { prompt_title = "Example Picker", finder = example_finder, sorter = sorters.get_generic_fuzzy_sorter(), })

-- 渲染 Picker

picker:find() -- 替换 finder 中的结果 picker.finder.results = { "a", "b", "c" }

-- 刷新 Picker,并重新渲染 picker:refresh(picker.finder, {})

3. `luafile %`

### Expected behavior

diaply in finder's Result
"a"
"b"
"c"

### Actual behavior

display in finder's Result
"1"
"2"

### Minimal config

```Lua
telescope.setup({
                defaults = {
                        -- Default configuration for telescope goes here:
                        -- config_key = value,
                        buffer_previewer_maker = new_maker,
                        prompt_prefix = " ",
                        wrap_results = true,
                        selection_caret = " ",
                        entry_prefix = "  ",
                        initial_mode = "insert",
                        selection_strategy = "reset",
                        sorting_strategy = "ascending",
                        file_ignore_patterns = { "^vendor/", "^target/" },
                        -- layout_strategy = "vertical",
                        layout_strategy = "horizontal",
                        layout_config = {
                                -- prompt_position = "bottom",
                                height = 0.90,
                                width = 0.85,
                                preview_cutoff = 1,
                        },
                        borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
                        color_devicons = true,
                        use_less = true,
                        set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
}})
alex-ross commented 1 year ago

I guess this is the same as my issue that I tried to search for now.

When I write a file path I often end up with a empty or incorrect list of files.

If I wait and then tapping the up arrow to navigate in the search result it re-renders and I then see the correct result.

If you, @3Xpl0it3r, navigate inside the list of results when this issue occures, do you then get the new correct list?

uiofgh commented 1 year ago

I guess this is the same as my issue that I tried to search for now.

When I write a file path I often end up with a empty or incorrect list of files.

If I wait and then tapping the up arrow to navigate in the search result it re-renders and I then see the correct result.

If you, @3Xpl0it3r, navigate inside the list of results when this issue occures, do you then get the new correct list?

Same here.