New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refine "Sort Blocks by Category" operation #1583
Comments
+1
== Hal
Hal Abelson
hal@mit.edu
Prof. of Comp. Sci. and Eng.
MIT Dept. of Elec. Eng. and Comp. Sci.
…On Sat, Mar 2, 2019 at 3:08 PM Evan W. Patton ***@***.***> wrote:
The "Sort Blocks by Category" menu item doesn't really do what its name
implies. Most blocks are sorted by category, yes, except for procedure and
component blocks, which they are sorted by name, and except for
any-component blocks, which are all "Component" for the purposes of sorting.
I propose that we refine the sorting algorithm to do the following:
1. Global defs first, lexicographically sorted
2. Procedure defs next, lexicographically sorted
3. Component event handlers, lexicographically sorted by type name,
instance name, then event name
4. Other free-floating blocks, sorted by category then block type. For
component blocks, they should be sorted internally first by type, whether
they are generic (generics precede specifics), then by instance name (for
specific blocks), then by method/property name.
If this is implemented after #1548
<#1548> is merged, I
propose that any component event handlers, sorted by type then event name,
precede all specific event handlers (step 2.5).
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1583>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAwLt0Z6kVqyPUq7FWA58HsYhxHaITXFks5vStoegaJpZM4baluV>
.
|
I would like to take a look at this issue! |
@xueyuanw It’s all yours. |
May I know what files I should look into? Thanks! |
@xueyuanw The logic for sorting by category is defined on line 627 of blocklyeditor/src/workspace_svg.js |
Another subtlety here that we should consider is when ordering by component name, if the component names end with numerals, we might want to sort those numerical rather than lexicographically, e.g., Button10 should sort after Buttons 2-9, not before. |
Implemented by #1612 |
The "Sort Blocks by Category" menu item doesn't really do what its name implies. Most blocks are sorted by category, yes, except for procedure and component blocks, which they are sorted by name, and except for any-component blocks, which are all "Component" for the purposes of sorting.
I propose that we refine the sorting algorithm to do the following:
If this is implemented after #1548 is merged, I propose that any component event handlers, sorted by type then event name, precede all specific event handlers (step 2.5).
The text was updated successfully, but these errors were encountered: