Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Code Syntax color formatting, etc (Read 1645 times)
Ralph Alvy
Full Member
*
Offline



Posts: 85
Santa Monica
Code Syntax color formatting, etc
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?
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Code Syntax color formatting, etc
Reply #1 - 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.
Back to top
 
 
WWW   IP Logged
Ralph Alvy
Full Member
*
Offline



Posts: 85
Santa Monica
Re: Code Syntax color formatting, etc
Reply #2 - Jul 27th, 2016, 12:01pm
 
Not sure where to turn on AutoCompletion in Tinderbox.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Code Syntax color formatting, etc
Reply #3 - 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.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Ralph Alvy
Full Member
*
Offline



Posts: 85
Santa Monica
Re: Code Syntax color formatting, etc
Reply #4 - 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.
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Code Syntax color formatting, etc
Reply #5 - 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!
Back to top
 
 
WWW   IP Logged
Ralph Alvy
Full Member
*
Offline



Posts: 85
Santa Monica
Re: Code Syntax color formatting, etc
Reply #6 - 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.
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Code Syntax color formatting, etc
Reply #7 - 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 Smiley
Back to top
 
 
WWW   IP Logged
Ralph Alvy
Full Member
*
Offline



Posts: 85
Santa Monica
Re: Code Syntax color formatting, etc
Reply #8 - Jul 27th, 2016, 4:20pm
 
Yep. That's why I only use TB for storing existing code, not editing it.
Back to top
 
« Last Edit: Jul 27th, 2016, 4:21pm by Ralph Alvy »  
  IP Logged
Pat Maddox
Full Member
*
Offline



Posts: 66

Re: Code Syntax color formatting, etc
Reply #9 - 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^
``` 

Back to top
 
 
  IP Logged
Ralph Alvy
Full Member
*
Offline



Posts: 85
Santa Monica
Re: Code Syntax color formatting, etc
Reply #10 - Nov 20th, 2016, 1:13pm
 
I now use Quiver for all code snippets, and TB for just about everything else.
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print