Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

"List recent notes" is actually listing from the oldest notes #20

Closed
ukyoi opened this issue Jun 12, 2018 · 5 comments
Closed

"List recent notes" is actually listing from the oldest notes #20

ukyoi opened this issue Jun 12, 2018 · 5 comments

Comments

@ukyoi
Copy link

ukyoi commented Jun 12, 2018

Thanks for reading this and please excuse my poor English.

I've used VSNotes a few times. Today I found the "List recent notes" function can't show my recent note files. With further comparison of the file in the note folder, I found this function actually listing from the oldest notes and the length of the list just exceed the limit of the list item.

Here is a picture which may explain the issue better:
image

@patleeman
Copy link
Owner

@ukyo The list recent notes functionality actually sorts the notes by last accessed time (mtime), not last created or by the timestamp in the note name. The idea behind this function is to quickly access the notes you've modified last. So by your screenshot, it looks to be working properly, if haven't gone back and edited any of the other notes.

Here's the code that sorts the last several notes in the folder. This functionality is also capped to a certain number of results. By default, it's set at 15, but you can change by setting vsnotes.listRecentLimit = X where X is your desired list length.

Does this clear up any confusion about what this feature does? Or did I not understand the issue?

@ukyoi
Copy link
Author

ukyoi commented Jun 13, 2018

@patleeman Thanks for you reply. Now I know where the problem is.

The sort function with the comparison function sorts the array ascending, but it need to reverse the list before (rather than after) running the following for loop, or the newest items will be dropped with the break of the loop if the length of the array exceed the limit of listRecentLimit.

OS: macOS 10.13.5
Hardware: MacBook Pro (Retina 13-inch, 2015)
VSCode version: 1.25.0 Insider

@patleeman
Copy link
Owner

Thanks for debugging that @ukyoi!

Unfortunately, I'm pretty busy these days and don't have much time to implement this fix. If you can submit a PR to fix this, that would be extremely helpful.

@patleeman
Copy link
Owner

Fixed in d1aa0cd

@ukyoi
Copy link
Author

ukyoi commented Jul 7, 2018

@patleeman Now it works like a charm. Thanks for your work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants