Skip to content

local-storage.js -- Add ability to 'get all keys' in local storage - #2598

Open
SharkPool-SP wants to merge 4 commits into
masterfrom
SharkPool-SP-patch-3
Open

local-storage.js -- Add ability to 'get all keys' in local storage#2598
SharkPool-SP wants to merge 4 commits into
masterfrom
SharkPool-SP-patch-3

Conversation

@SharkPool-SP

Copy link
Copy Markdown
Collaborator

Resolves:
#1358

Add 'getAll' method to retrieve all keys from storage.
@github-actions github-actions Bot added the pr: change existing extension Pull requests that change an existing extension label Jul 20, 2026
@SharkPool-SP

Copy link
Copy Markdown
Collaborator Author

!format

DangoCat and others added 2 commits July 20, 2026 05:50
Added a note on retrieving all keys from local storage.
@SharkPool-SP
SharkPool-SP requested review from a team and Brackets-Coder July 20, 2026 17:17
@GarboMuffin

Copy link
Copy Markdown
Member

i think i've shared my thoughts on adding new blocks that returns lists as JSON ...

@SharkPool-SP

Copy link
Copy Markdown
Collaborator Author

i think i've shared my thoughts on adding new blocks that returns lists as JSON ...

And several blocks in extensions in your gallery do this, there isn't a proper alternative.

I don't know what you expect it should do.

@Brackets-Coder

Brackets-Coder commented Jul 30, 2026

Copy link
Copy Markdown
Member

Tend to agree with Garbo here. JSON is hard to work with without the JSON extension. Native Scratch is usually space-delimited for similar blocks. Of course, when doing something like this, you could run into parsing issues when the key or item contains the delimiter in its name, e.g., item 1 item 2 item 3, where instead of item 1 being parsed it may come out as item 1.

Screenshot 2026-07-30 at 9 13 41 AM

@SharkPool-SP

Copy link
Copy Markdown
Collaborator Author

Then what's the better alternative?

The scratch method has its flaws with commas or spaces.

And for this block to actually be useable they'd have to split the output to an array or to different parts using text extension (which is an extra dependency regardless)

@Brackets-Coder

Brackets-Coder commented Jul 30, 2026

Copy link
Copy Markdown
Member

I don't know. With a bit of extra work you can split by spaces pretty easily in native Scratch, but it doesn't really work when the values contain the delimiter, which is why I think JSON is better. Unfortunatley, it's another extension users would have to load and potentially is more confusing for some users

@SharkPool-SP

Copy link
Copy Markdown
Collaborator Author

I don't know. With a bit of extra work you can split by spaces pretty easily in native Scratch, but it doesn't really work when the values contain the delimiter, which is why I think JSON is better. Unfortunatley, it's another extension users would have to load and potentially is more confusing for some users

And like I said, if you split by spaces, users would have to add the text extension to use the block to split text by a delimiter.

That is unless the user wants to make their own parser, which is bulky and in the long run a waste of their time if they could use the alternative.

@SharkPool-SP

Copy link
Copy Markdown
Collaborator Author

Let's not forget some extensions in the gallery already do this... plus it's always reality that if the user doesn't understand the block, they won't use it which is fine.

@Brackets-Coder

Copy link
Copy Markdown
Member

Okay

@ScratchFakemon

Copy link
Copy Markdown
Contributor

I agree with SharkPool here; plenty of extensions have blocks that return information as JSON, and there's a JSON extension for a reason. The list reporters aren't particularly good at conveying information anyway, so a space-separated list of keys won't be much different.
image image
image image

@GarboMuffin

Copy link
Copy Markdown
Member

i'm not proposing a space separator

@GarboMuffin

Copy link
Copy Markdown
Member

the scratch approach to lists is not big json

the scratch approach to lists is blocks like "length of list" and "item 1 of list"

no reason you can't have "number of things in storage" and "key of item 1 in storage" equivalent

or even a "store keys in [list]" block

@CST1229

CST1229 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

i'm not proposing a space separator

well thats what we all assumed

should have specified earlier

@SharkPool-SP

Copy link
Copy Markdown
Collaborator Author

Exactly

@GarboMuffin

Copy link
Copy Markdown
Member

Ok

@SharkPool-SP

Copy link
Copy Markdown
Collaborator Author

!format

@github-actions

Copy link
Copy Markdown

The formatting bot didn't find any formatting issues. It currently only checks the extensions folder. The author or a maintainer can run terminal command 'npm run format' manually to format all files.

@SharkPool-SP

Copy link
Copy Markdown
Collaborator Author

@GarboMuffin @Brackets-Coder fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: change existing extension Pull requests that change an existing extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants