fix: glad this stuff gets squashed

This commit is contained in:
dlond 2025-09-03 09:17:35 +12:00 committed by Daniel Lond
parent 369887becb
commit 829e0c4bc5
1 changed files with 16 additions and 10 deletions

View File

@ -46,23 +46,29 @@ function M.pick_compile_commands()
local actions = require('telescope.actions') local actions = require('telescope.actions')
local action_state = require('telescope.actions.state') local action_state = require('telescope.actions.state')
-- Use Telescope's built-in file picker configuration -- Create a simple path array for the finder
local paths = {}
local path_to_info = {}
for _, file in ipairs(files) do
table.insert(paths, file.path)
path_to_info[file.path] = file
end
pickers.new({}, { pickers.new({}, {
prompt_title = 'Select compile_commands.json', prompt_title = 'Select compile_commands.json',
finder = finders.new_table { finder = finders.new_table {
results = files, results = paths, -- Pass simple path strings
entry_maker = function(entry) entry_maker = function(path)
local info = path_to_info[path]
return { return {
value = entry, value = info,
display = entry.display, display = info.display,
ordinal = entry.display, ordinal = info.display,
filename = entry.path, path = path, -- This is what the previewer needs
path = entry.path,
cwd = vim.fn.getcwd(),
} }
end, end,
}, },
sorter = conf.file_sorter{}, sorter = conf.generic_sorter{},
previewer = conf.file_previewer{}, previewer = conf.file_previewer{},
attach_mappings = function(prompt_bufnr, map) attach_mappings = function(prompt_bufnr, map)
actions.select_default:replace(function() actions.select_default:replace(function()