Skip to content

Commit

Permalink
Add support for telescope previewer and opts
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvaro Muñoz committed Jan 24, 2024
1 parent 61df3ba commit 292f495
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
4 changes: 4 additions & 0 deletions lua/codeql/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ function M.setup(opts)
find_databases_cmd = nil,
-- Telescope entry maker for the list of databases
database_list_entry_maker = nil,
-- Telescope previewer for the list of databases
database_list_previewer = nil,
-- Telescope options
telescope_opts = {},
results = {
max_paths = 4,
max_path_depth = nil,
Expand Down
15 changes: 4 additions & 11 deletions lua/codeql/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,19 @@ function M.list_databases()
util.err_message("find_databases_cmd should be a list of strings")
return
end
local opts = {}
local opts = config.values.telescope_opts
local entry_maker = config.values.database_list_entry_maker
if not entry_maker then
entry_maker = function(line)
return {
value = line,
display = line,
ordinal = line,
}
end
end
local previewer = config.values.database_list_previewer


local results = utils.get_os_command_output(cmd)
pickers.new(opts, {
prompt_title = "CodeQL Databases",
entry_maker = entry_maker,
finder = finders.new_table {
results = results,
entry_maker = entry_maker,
},
previewer = previewer(opts),
sorter = conf.values.generic_sorter(opts),
attach_mappings = function(prompt_bufnr)
actions.select_default:replace(function()
Expand Down

0 comments on commit 292f495

Please sign in to comment.