Feature Request: Snap Code Editor

Idk if it's appropriate, but I'd like to see a code editor so that I can look like an actual programmer rather than a child one (not really).

Let it be a toggle to switch between the blocks mode and the text editor mode. I don't want to make things complicated for 10.0, but just asking IF it's possible.

Also, no Javascript please! (JS hard to work with)

Unfortunately, the only thing similar to looking text based is by changing the fade blocks setting.

If you really want to use text based snap, the closest thing is Tosh, text-based scratch. It doesn't have all the features as snap, but it is scratch, so it's similar.

I do want to mention that I have seen that a user (idk who) was working on a text-based snap mod, but idk if it's even close to being usable.

Do you know about the keyboard editor? Between that and the ^F search feature, you can get close to text-editing speed.

do you know about the "fade blocks" feature?

Fade blocks? I remember seeing it in settings and turning it on, but i don't remember seeing any differences

Upd. Alright i probably confused it with other setting. Yeah i tried fade blocks before, but considering how blocks (mostly operators) combine, it's really still not the best way to see the code. My gf is like a low level code dev, while im into visual dev like scratch/snap, and whenever i ask her to help with something, she gets very confused in blocks, while its pretty easy for me, and its kinda reverse, i get confused in text coding a lot. I think Snap Code Editor is a good idea, because, why not? Snap is in JS right? Aren't blocks just js functions etc? What about just inspecting the text code, without being able to change it?

Upd2.
image
oh

Fade Blocks hides the blocks away and shows only a text interface, the blocks are still actually there and when you mouse over them you see a faded outline.

Somehow a couple weeks ago, I got a bug that I can't replicate, that had the faded blocks but all the inputs were white as usual, and I actually thought that was really cool.

Ooh, wash your mouth out with soap. Jens gets mad when people say that.

Snap! is implemented in JS. Similarly, JS is implemented in something, which is implemented in something, which is implemented in the machine language of whatever kind of computer you have. By that standard, all programming languages are the same.

But in its design, Snap! isn't based on JS at all. For example, JS claims to use prototyping OOP, but what it actually does is this hugely complicated thing that ends up really being class/instance OOP with the classes renamed "prototypes." Real prototyping is all about a tinkering style of work in which you build one object (one instance) and then use it as the basis for another object, while maintaining the ability to edit the original and see the edits reflected in its children. The only other real prototyping language I know of is Object Logo, from which we got the idea.

As another example, it took us three tries to get gray rings right, namely, with the ring already in procedure-type input slots in higher-order blocks such as MAP, as they appear in the palette. It's a lot harder to understand higher order functions if you have to attach the ring explicitly to the actual procedure-type input.

In fact, imho, the worst parts of Snap! are the ones in which we allow JS semantics to expose themselves to users, such as the hideous error messages and the confusions among zero, false, and the empty string.

If you want to do text programming that feels Snap!-like, learn Scheme and/or Smalltalk and/or APL. Those are the languages that have contributed most to our design. (And Scratch, of course, but it's not a text language.)

it would be helpful to learn to use said text-based language; to make a script using block code then examining the conversion.

My suggestion would be that we would have text editor window in which we would be able to at least view the code. Tho, adding feature to manage it doesn't look difficult too anyway. I still believe it's possible to make, i will make one interesting project covering this idea soon.

Look up "codification" in the Manual.

Great idea! Make your own. :~)

Not current codification tho, why won't you guys remake codification? I mean, you added new stuff in v8, which is cool, but it broke codification

I think the closest you can get is turning the fade blocks settings all the way up and using keyboard coding

In what way?

My OpenSCAD codification project still works fine on V9

I'll be interested to see how you do this as well.

multiple inputs

anyway im working on some codification lib, so i will fix that soon

i kind of want to recreate tosh's syntax in snap, i am 0 in gui stuff tho, i ll probably need a help from some snap expert to make text editor window after i make syntax, functions for all blocks, and docs

Tosh 's syntax is interesting, but I feel it misses the point. Like you being a 0 on gui, I'm, no matter how hard I try, a zero on everything. Otherwise I'd help.

Which is why I generally, aside from disastrous lightning talks at snapcon! try to keep my opinions to myself, because I can't prove any of it.

It's a good idea, but instead of doing what tosh did, make it a side by side window. Block Scripting on the left hand side and Text Scripting on the right hand side mirroring it what's in the blocks or vice versa.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.