Sandcastle has long been a cornerstone of the CesiumJS developer community. We use it for showcasing features, sharing ideas, learning, prototyping, experimenting, and validating code. Its accessibility has played a key role in the success of CesiumJS and the community.
To build on that success, it’s time to modernize and upgrade Sandcastle. We want your input on both functionality and design. What features matter most to you? Are there improvements you’d like to see? What aspects should remain unchanged? Are there development environments you love that we can learn from? Examples and links are always appreciated!
Topics on our mind
Modern framework and stack: We plan to refactor the Sandcastle app using modern build tools and a UI framework, potentially React. CesiumJS itself will remain framework-agnostic.
Developer experience improvements: We’re looking at modern online code editing tools like Monaco, the open-source editor used in VS Code.
Responsive design: The current layout is difficult to use on mobile and smaller screens.
Better searching: Right now, searches rely only on demo code and titles, making it hard to find relevant examples unless using exact vocabulary. And good luck trying to search for the “labels” example!
Learning paths: Sandcastle is meant to help users learn the CesiumJS API, but with so many examples, first-time users may struggle to navigate.
Keeping what works
While there are many opportunities for improvement, we also want to preserve the aspects that have made Sandcastle successful.
Easy sharing: Despite long URLs, custom Sandcastle examples are easily shareable. Ideally, existing Sandcastle links should remain backward-compatible.
Example code in the same repository as the source code: This ensures that example code stays up-to-date with the latest API and that core library changes do not break existing functionality.
No server-side component: A lightweight, static web app is crucial for portability, especially for users working in disconnected environments.
We’d love to hear your thoughts! What features or changes would make Sandcastle even better for you?
Looking forward to being able to format the code in Sandcastle! Right now I have to copy the code from Sandcastle into VS Code, format it, then paste it back into Sandcastle before I share the link. Otherwise the code is a mess because I don’t bother about spaces/indents when editing and rely on the editor to do that.
Hey @Gabby_Getz,
I sure do admire Cesium Sandcastle—it’s a great tool!
I’ve been thinking about how we might make the search function for Sandcastle even better, and I’d like to share an idea with you.
How about this: whenever developers create and save their own Sandcastle examples, they could include some important keywords tied to their work.
This way, other folks could find those Sandcastles more easily through Google or other search engines.
Another thought—wouldn’t it be helpful if we had a way to leave comments on each Sandcastle?
That way, folks could share their thoughts, review the work, and suggest ideas for improving or building on the code.
I reckon it’d be a great way to help folks learn from one another and grow the community around Sandcastle.
What do you think?
The ability to easily set breakpoints in JavaScript running in the sandbox would be nice.
Integrating the sandbox with revision control, (maybe gists?), would be very handy. At the moment, I have to make sure I routinely copy code out to avoid losing it if the window is unintentionally closed.
If possible, a legacy mode to return to the code editor the way it is now would be nice. VS Code tends to be too distracting and helpful, (automatic closing " as an example.) I’m sure there are ways to turn those features off, but that’s just another thing to learn rather than typing in code.
For the first one, there’s the workaround of adding a debugger;
statement at the right place, but that’s a bit clumsy and cannot be toggled dynamically.
For the second one: Many browsers do have that confirmation dialog that says ~“You have unsaved changes, to you want to close?”. But still (particularly when doing more experimental stuff or investigating some bug), a crashing browser tab can cause the contents to be lost (so I also constantly “mirror” the code in an independent editor). Somehow “caching” the latest code would be nice.
I think this is very much top of mind for those who often work in Sandcastle.
Thanks for this thought. Monoco appears to have plenty of configuration options. I wonder if we can expose a top-level “simple” editing mode which is just text for those who prefer.
Another for ^ that. While it is technically possible to select an older sandcastle version from the releases pages (like https://cesium.com/downloads/cesiumjs/releases/1.127/index.html ), being able to switch the version “at runtime” (without leaving the sandcastle) could be really helpful for debugging, e.g. to identify a version where a certain issue was introduced or fixed.
One thing that is somewhat independent of the technical aspects of the upgrade itself, but may be related to the point about “searching” and “learning paths”:
There should be smaller Sandcastles, that are more focussed on specific points. Maybe it could be described as something between the “Snippets” that are shown in the documentation, and the actual Sandcastles, as they are structured right now.
For example, consider something like the Materials sandcastle. It stands at a whopping 560 lines. About 90% of that is about setting up the Sandcastle UI. There are zero comments (except for // For highlighting in Sandcastle, which appears 21 times…).
And this Sandcastle should be kept, exactly the way it is! (Because it’s cool to have these many options to select from, and to explore the capabilities).
But for someone who wants to get started, is looking for examples, and is going along a “learning path”, there should additionally be a Sandcastle like this - preferably, easy to find, when searching for the answer to a question like “How to apply an image texture to a rectangle?”.