Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Questions and Answers >> Code Syntax color formatting, etc
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1469570122

Message started by Ralph Alvy on Jul 26th, 2016, 5:55pm

Title: Code Syntax color formatting, etc
Post by Ralph Alvy on Jul 26th, 2016, 5:55pm

Are there plans to eventually include Code Syntax Formatting (color, indents, etc.) for snippets of code the user places in the Text Pane, similar to what some text editors offer?

Title: Re: Code Syntax color formatting, etc
Post by Mark Bernstein on Jul 27th, 2016, 10:57am

That might be overkill for Tinderbox, where most actions are fairly short.  We already have autocompletion, after all!  Really complex actions are occasionally needed, but I find that they're often a sign that a function would benefit from a different design, dividing the work among several notes or agents.

Title: Re: Code Syntax color formatting, etc
Post by Ralph Alvy on Jul 27th, 2016, 12:01pm

Not sure where to turn on AutoCompletion in Tinderbox.

Title: Re: Code Syntax color formatting, etc
Post by Mark Anderson on Jul 27th, 2016, 12:57pm

Tinderbox isn't a coding environment.  If you do want to write/store computer code (Tinderbox action code or other) definitely the first action to make in a new document is to add the built-in "Code"  prototype. This sets a monospace font and turns off (most!) of the 'corrections' beloved of those writing in RTF, e.g. coercing straight quotes to 'smart' (curly) quotes. There's no right or wrong - it's a matter of unstated assumptions.

Auto-complete is automatic in various parts of Tinderbox, though not in note text ($Text) which I suspect what your after as in a coding text editor like Sublime Text (or even BBEdit). All input boxes for Action-type attribute in the Inspector and Get Info/agent will autocomplete attribute names and action code operators (though unlike IDEs won't then highlight 'code' words). Key Attribute tables and Get Info/attributes will auto-complete attribute values for String -based attributes including List/set. Other pop-ups like Column view setters, table headings, etc., will autocomplete attribute names (though in this case only if you omit the $ prefix)

Speaking as a long term user (>14 yrs) of the app this does seem quite niche. Tinderbox's core usage—as observed from >10yrs as a Tinderbox community helper—is in several (partly-overlapping) areas: writing hypertexts, blog (web) writing/export, textual analysis,
todo/GTD, syllabus/teaching planning. There are plenty more, and exotic too, but general coding is not one I've encountered so I think MB's comment about 'overkill' is fair as not only would code libraries need connecting but all the wider needs of an IDE might need to be added in (dev cost!).

Lest you assume otherwise, this isn't a negative response. I do write/store code in Tinderbox. Indeed, I'm arguably the progenitor of the 'Code' prototype. So what you want isn't there, but auto-complete still offers a lot.

Title: Re: Code Syntax color formatting, etc
Post by Ralph Alvy on Jul 27th, 2016, 2:08pm

Thanks, Mark A. I really don't plan on coding in TB, but I do store code there often and that works for me. I had just tested Quiver for doing that yesterday, and liked seeing it nicely formatted and highlighted. But I prefer keeping it all in TB because of its agents and prototypes facilities, and seemingly unlimited levels of outlining.

I could just use something like Quiver just for code snippets, but I like those snippets stored with development notes I keep in TB.

Title: Re: Code Syntax color formatting, etc
Post by Mark Bernstein on Jul 27th, 2016, 2:31pm

Ah -- I misunderstood!  I thought you were worried about syntax highlighting within Tinderbox actions.  That seems gilding the lilly, when a typical action might be

     $Color="red";

The problem with trying to use Tinderbox to store text snippets is, ultimately, that we’ve got a styled text field. Most code editors stick to single fonts at a fixed size, and many stick to monospaced fonts.  That simplifies lots of things!

Title: Re: Code Syntax color formatting, etc
Post by Ralph Alvy on Jul 27th, 2016, 3:04pm

The fact that text is stored styled in TB isn't a problem because I always paste without formatting between apps.

Title: Re: Code Syntax color formatting, etc
Post by Mark Bernstein on Jul 27th, 2016, 3:42pm

But it's a problem for code editing, because it’s vastly more difficult to typeset styled text in arbitrary fonts than it is to format text in a single monospaced font :)

Title: Re: Code Syntax color formatting, etc
Post by Ralph Alvy on Jul 27th, 2016, 4:20pm

Yep. That's why I only use TB for storing existing code, not editing it.

Title: Re: Code Syntax color formatting, etc
Post by Pat Maddox on Nov 20th, 2016, 9:53am

If your editor supports as "copy as RTF" feature, you can use that. I use Atom's copy-as-rtf plugin. Just copy as RTF from Atom, and paste into Tinderbox's text field. It doesn't necessarily copy the syntax highlighting exactly – it runs the code through pygment – so if you want the exact highlighting you'll need to use an Atom theme that corresponds to a pygment theme.

Unfortunately Tinderbox loses the formatting when exporting to an HTML file... but you might prefer that anyway. For example, you might set your code snippets to export using github flavored markdown:


Code:
```ruby
^Text^
```

Title: Re: Code Syntax color formatting, etc
Post by Ralph Alvy on Nov 20th, 2016, 1:13pm

I now use Quiver for all code snippets, and TB for just about everything else.

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.