Skip to content

Commit

Permalink
fix: can't delete a session from Telescope picker
Browse files Browse the repository at this point in the history
Sometimes deleting a session from the the Telescope picker wasn't
working. It happens when we have extra command files that are filtered
out from the list. Those files break some code in Telescope that finds
the item we want to delete in the picker results. More detail is here:

nvim-telescope/telescope.nvim#3265

We work around the issue by having the Telescope entry maker returning
{} instead of nil. That's not perfect but better than not being able to
delete/
  • Loading branch information
cameronr committed Aug 22, 2024
1 parent e5bd814 commit 008b907
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/auto-session/session-lens/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ function SessionLens.make_telescope_callback(opts)
-- Don't include <session>x.vim files that nvim makes for custom user
-- commands
if not Lib.is_session_file(session_root_dir .. file_name) then
return nil
-- FIXME: Returning nil would be better here since otherwise the result count
-- will be off. However, returning nil can prevent delete from working so return {}
-- until this is fixed:
-- https://github.com/nvim-telescope/telescope.nvim/issues/3265
return {}
end

-- the name of the session, to be used for restoring/deleting
Expand Down

0 comments on commit 008b907

Please sign in to comment.