nvim-telescope / telescope-project.nvim

MIT License
583 stars 53 forks source link

feat/order: fix order by recently opened, add order by setting #112

Closed AntoscencoVladimir closed 2 years ago

AntoscencoVladimir commented 2 years ago

Hello, here is the fix for recent open project sort and order by setting feature.

In my tests this method not worked as expected

M.get_last_accessed_time = function(path)
  local expanded_path = vim.fn.expand(path)
  local fs_stat = vim.loop.fs_stat(expanded_path)
  return fs_stat and fs_stat.atime.sec or 0
end

When project change via plugin the atime of folder not changed so that we always have same time there and projects are not ordered as expected. However if I use GUI (the finder in my PC) and go to the project folder > the atime change. As a workaround I stored the last accessed time in project string. In addition added new setting order_by so that we can order projects asc, desc and recent(default)

Please check if it's ok for you

Thanks

claidler commented 2 years ago

This is great @AntoscencoVladimir thanks for your work here