observablehq / feedback

Customer submitted bugs and feature requests
42 stars 3 forks source link

Support alphabetical sorting in minimap #389

Open mootari opened 2 years ago

mootari commented 2 years ago

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))
tophtucker commented 2 years ago

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.

nachocab commented 2 years ago

@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).