scratchfoundation / scratchfoundation/scratch-blocks

Local variables should all be sorted after global variables

Open
#1,636 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature needs-triage
Dominant language
JavaScript
Stars
2.8k
Forks
1.6k
Avg merge
4h 51m
Merged PRs (30d)
12

Description

Expected Behavior

Local variables should, in the block palette, be sorted so that they all appear (in alphanumeric order) after all the global variables.

Actual Behavior

Local variables and global variables are sorted together.

Steps to Reproduce

Create a global variable such as "A". Create a local variable such as "B". Create a global variable such as "C". Note that the sort order is A, B (local), C, not A, C, B (local).


This sort of ties into #1379. I believe in 2.0 all variables are sorted together, so I suppose this is a request more than a compatibility issue. It should be noted that Scratch 1.4 has a visible horizontal-rule separator between global variables and local variables:

A, C; separator line; B. Scratch 1.4.

I don't think scratch-blocks has support for <hr>-style separators, but it does have ordinary separator spaces (e.g. between "point towards mouse-pointer" and "change x by 10"). Could be useful here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the block palette collects and sorts global and local variables, then reproduce the A/global, B/local, C/global example from the issue. Done means globals appear first in alphanumeric order, followed by locals in alphanumeric order, with the resulting palette behavior matching the requested ordering.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.