Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Patch sorting popup autocomplete items and initial builtin items #2518

Merged
merged 5 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lua/telescope/builtin/__internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ internal.builtin = function(opts)
end
end

table.sort(objs, function(a, b)
return a.text < b.text
end)

opts.bufnr = vim.api.nvim_get_current_buf()
opts.winnr = vim.api.nvim_get_current_win()
pickers
Expand Down
12 changes: 10 additions & 2 deletions plugin/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ end, {
local n = #l - 2

if n == 0 then
local commands = vim.tbl_flatten { builtin_list, extensions_list }
table.sort(commands)

return vim.tbl_filter(function(val)
return vim.startswith(val, l[2])
end, vim.tbl_flatten { builtin_list, extensions_list })
end, commands)
end

if n == 1 then
Expand All @@ -128,13 +131,18 @@ end, {

if #is_extension > 0 then
local extensions_subcommand_dict = require("telescope.command").get_extensions_subcommand()
local commands = extensions_subcommand_dict[l[2]]
table.sort(commands)

return vim.tbl_filter(function(val)
return vim.startswith(val, l[3])
end, extensions_subcommand_dict[l[2]])
end, commands)
end
end

local options_list = vim.tbl_keys(require("telescope.config").values)
table.sort(options_list)

return vim.tbl_filter(function(val)
return vim.startswith(val, l[#l])
end, options_list)
Expand Down