Skip to content

Commit a559019

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 b4da76b commit a559019

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

lua/telescope/pickers.lua

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

325325
cache_picker = config.resolve_table_opts(opts.cache_picker, vim.deepcopy(config.values.cache_picker)),
326326

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

329329
__locations_input = vim.F.if_nil(opts.__locations_input, false),
330330
}, self)
@@ -571,11 +571,8 @@ function Picker:find()
571571
vim.fn.prompt_setprompt(self.prompt_bufnr, prompt_prefix)
572572
self:_reset_prefix_color()
573573

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

580577
vim.api.nvim_buf_set_lines(self.results_bufnr, 0, self.max_results, false, utils.repeated_table(self.max_results, ""))
581578

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)