Suggested code editor app?

(JESP) #1

Is there a suggested code writing / editing app for typing up code before I copy & paste it into Tinderbox?

(Mark Anderson) #2

It’s OK start inside Tinderbox, not least as no other apps have support for Tinderbox action/export code syntax. The main gotchas are using ‘smart’ RTF typing spaces that screw around with quotes and such for (legitimate) visual typographic reasons.

Thus, I normally just add the built-in ‘Code’ prototype, and use that for a note. The prototype takes care of getting ‘wrong’ type of quotes and multiple dashes being turning into long dashes (i.e. -- becoming ), etc. It also sets a ruler style with lots more tabs than the doc default which is useful if you like to indent code (e.g. if() statement branches) for clarity, or are making tab-delim templates and such.

If you’ll have lots of such notes, consider adding a container (e.g. /Codes, alongside your /Prototypes container) and setting its OnAdd to:$Prototype="Codes";. That way any new note you add to the container gets the right prototype before you start adding $Text.

Code wrapping in the $Text area? Open the note as a standalone window (Cmd+Opt+X) and you can make the $Text are much bigger.

Some folk who use this approach like to make a (short) note of the code purpose and add a user String attribute $CodeComment to the Code prototype and set it as a key attribute.

If you want/need to write Tinderbox code outside the app, use a ‘text editor’ such as you might use for coding or scripting. I use BBEdit, whose free (unlicensed) mode now replaces the old free TextWrangler. One nice aspect of using a code editor is you can usually control things like making spaces and tab characters visible and turning off auto line wrap (useful if on a small screen). I also use SublimeText, but mainly as I have - there are many such similar tools in this class. As last resort you can use TextEdit, that ships in all Macs, but before adding code to a new doc, turn off RDF and work in plain text mode. As many code editors have a free version, e.g. BBEdit, I’d strongly recommend using such a tool rather than TextEdit, but the choice is yours!

You might also find the ‘code note’ approach of interest.

I hope that helps - do ask if you’ve further questions arising from the above (please consider starting a new topic if the questions is at a tangent to this). :grinning:

(eastgate) #3

Most Tinderbox actions are very simple, and can be typed directly into the Inspector.


Using the Inspector or the Agent Pane of Get Info gives you useful hints and autocomplete. I find that, when actions get complicated, it’s often better to step back and ponder; two simple actions often do the work of one complex action with far less bother.

When it can’t be helped, a code note can be handy. BBEdit’s always handy; I use it every day, though seldom for writing actions.

(JESP) #4

Thanks so much to both of you for this. Really appreciate it. I overlooked how to use the Code prototype to accomplish what I was seeking to do. That’s very helpful.