feedback icon indicating copy to clipboard operation
feedback copied to clipboard

Support alphabetical sorting in minimap

Open mootari opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe.

The minimap lists cells in the order in which they appear in the notebook. If only the name of a cell is known, a user must scan through the entire list of cells in order to locate the cell.

Describe the solution you'd like

Add an option within the minimap to sort cell names alphabetically. This also allows named cells to be listed before unnamed cells.

Describe alternatives you've considered

The following user script can be run once the minimap is open, but it will mess up the left-hand dependency lines:

Array.from(document.querySelector('.minimap-cell-label').parentElement.parentElement.children)
    .map(n => [n, n.querySelector('span')?.textContent || `\uffff${n.querySelector('.code').title}`])
    .sort(([,a],[,b]) => a.localeCompare(b))
    .map(([n]) => n.parentElement.appendChild(n))

mootari avatar Mar 21 '22 22:03 mootari

This is a good point. Do you think the underlying issue is that you want to be able to jump to a cell by name, and alphabetical order is just a way of achieving that? I can imagine using alphabetization as a transient lookup table in the time-honored tradition of Callimachus, but I don't think I’d want to keep it in alphabetical order, and it could be disorienting for it to change orders.

So I think the way I’d want to approach the problem of “a user must scan through the entire list of cells in order to locate the cell” is to add a Cmd-P omnibox/command palette (do we have an issue for that in here yet? it's come up from time to time, I know we do internally…) where you can type the name of a cell to focus it, and then keyboard shortcuts to open all sidebar panes.

But maybe it’s nice to be able to scan all symbols alphabetically, in parallel, to apprehend the whole. (Do you find yourself doing that in other programming environments? Not sure I do, or how I’d do it.) If we did add different orderings I’d want to add topological order too.

tophtucker avatar Jul 20 '22 14:07 tophtucker

@mootari Another alternative would be to add a global keyboard shortcut to activate the minimap and directly allow searching (like the symbol panel in VS Code).

nachocab avatar Aug 28 '22 11:08 nachocab