Skip to content

Commit eff18a7

Browse files
committed
feat(pickers): allow the scrolling limit to be configured
Promote the "temp__scrolling_limit" option into an officially supported configuration field that controls the number of results displayed by pickers. Closes: #2779
1 parent e69b434 commit eff18a7

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

lua/telescope/pickers.lua

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ function Picker:new(opts)
321321

322322
cache_picker = config.resolve_table_opts(opts.cache_picker, vim.deepcopy(config.values.cache_picker)),
323323

324-
__scrolling_limit = tonumber(vim.F.if_nil(opts.temp__scrolling_limit, 250)),
324+
scrolling_limit = tonumber(vim.F.if_nil(opts.scrolling_limit, 250)),
325325

326326
__locations_input = vim.F.if_nil(opts.__locations_input, false),
327327
}, self)
@@ -568,11 +568,8 @@ function Picker:find()
568568
vim.fn.prompt_setprompt(self.prompt_bufnr, prompt_prefix)
569569
self:_reset_prefix_color()
570570

571-
-- TODO: This could be configurable in the future, but I don't know why you would
572-
-- want to scroll through more than 10,000 items.
573-
--
574571
-- This just lets us stop doing stuff after tons of things.
575-
self.max_results = self.__scrolling_limit
572+
self.max_results = self.scrolling_limit
576573

577574
api.nvim_buf_set_lines(self.results_bufnr, 0, self.max_results, false, utils.repeated_table(self.max_results, ""))
578575

lua/tests/automated/pickers/live_grep_spec.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe("builtin.live_grep", function()
3535
sorter = require("telescope.sorters").get_fzy_sorter(),
3636
layout_strategy = "center",
3737
cwd = "./lua/tests/fixtures/live_grep",
38-
temp__scrolling_limit = 5,
38+
scrolling_limit = 5,
3939
}, vim.json.decode [==[%s]==])
4040
)
4141
]],

0 commit comments

Comments
 (0)