Skip to content

feat(notes): sort notes by name, date modified or date created - #103

Merged
dionmunk merged 2 commits into
masterfrom
feat/sort-notes
Oct 7, 2026
Merged

dionmunk merged 2 commits into
masterfrom
feat/sort-notes

Conversation

@dionmunk

@dionmunk dionmunk commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Notes and folders were always sorted by name (#22, #63).

Changes

  • Sort By button after Search in the title bar of Notes and Workspace Notes. It opens a short list: Name A to Z (the default), Name Z to A (asked for in Sort Notes by Modified/Creation Date #63), Date Modified newest first, and Date Created newest first. The current order is marked with a check.
  • The choice is saved in a new notes.sortOrder setting, so it persists and also shows in Settings, like the Explorer's explorer.sortOrder. It's written to the user settings, or to the workspace settings when they already set it.
  • Folders stay first, as in the Explorer. Dates are read only when a date order is chosen. Where a file system doesn't record when a file was created, the date modified is used.
  • List Notes (Alt+L) orders the notes after the recently opened ones (feat(notes): show recently opened notes first in List Notes #102) the same way.
  • Refresh and Settings move to the ... menu of each section, next to Reveal in File Explorer and the location commands, so the title bar shows New Note, New Folder, Search and Sort By.

Extensions can't show a check mark on a menu item: the schema for contributes.commands in VS Code 1.140 has category, command, icon, enablement, shortTitle and title, and menu items have command, alt, group, submenu and when, but no toggled. That's why the button opens a list (like the Extensions view's filter) rather than a menu of checked items (like Outline's Sort By, which is built into VS Code).

Testing

  • npm test: 41 passing, 6 new tests for the order (each order, folders first, the same date falling back to the name, an unknown setting).

  • End to end in VS Code 1.140 on macOS. Notes and folders were created a second apart (archive, work, alpha, beta, gamma), then alpha was rewritten and a note was added to archive, so the two date orders differ:

    Sort by Tree
    Name, A to Z archive, work, alpha, beta, gamma
    Name, Z to A work, archive, gamma, beta, alpha
    Date Modified archive, work, alpha, gamma, beta
    Date Created work, archive, gamma, beta, alpha

    Each choice was saved as notes.sortOrder in the user settings, the list marked the current order with a check, and List Notes followed Date Modified (old.md, in archive, changed last, came first).

  • Title bar and ... menu, with Notes only and with both sections:

    • icons: New Note, New Folder, Search, Sort By
    • Notes ...: Reveal in File Explorer, Set Up Workspace Notes (when the workspace has no notes), Refresh Notes, Settings
    • Workspace Notes ...: Reveal in File Explorer, Select Workspace Notes Location, Refresh Notes
    • Refresh Notes and Settings work from the menu; Settings opens filtered to Notes, with the new Sort Order setting.
  • Not tested: Windows and Linux; on Linux, whether a file's creation date is available depends on the file system.

Closes #22, closes #63.

Notes were always sorted by name (#22, #63). A Sort By button after Search in
each section offers name A to Z, name Z to A, and newest first by date modified
or date created, saved in the new notes.sortOrder setting. Folders stay first,
as in the Explorer, and List Notes uses the same order after the recently
opened notes.

Extensions can't show a check mark on a menu item (contributes.commands has no
toggled), so the button opens a list that marks the current order instead.
Where a file system doesn't record when a file was created, the date modified
is used.
The title bar of each section keeps New Note, New Folder, Search and Sort By;
Refresh and Settings join Reveal in File Explorer and the location commands in
its ... menu.
@dionmunk
dionmunk merged commit e67cbdb into master Oct 7, 2026
1 check passed
@dionmunk
dionmunk deleted the feat/sort-notes branch October 7, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sort Notes by Modified/Creation Date Feature request: toggle sort by name/date

1 participant