We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Code Snippet management

Erich
Booster
Do any of you use any outside programs for GDL code snippet management? Searching through my parts for that piece of code that fits my current needs, just isn't cutting it anymore.

I have found, and am currently trying, a program called CodeBox that seems fairly good (and has fantastic developer response). Does anyone have other ideas (Mac based)?


Also, if anyone else is using CodeBox, do you have a TextMate .tmTheme for it that works for GDL (to provide syntax highlighting)?
Erich

AC 19 6006 & AC 20
Mac OS 10.11.5
15" Retina MacBook Pro 2.6
27" iMac Retina 5K
16 REPLIES 16
Karl Ottenstein
Moderator
Erich wrote:
Does anyone have other ideas (Mac based)?
Xcode 4 supports drag and drop code snippets. Will be free with Lion. Until then, Xcode 4 is $5 from the Mac App Store. (HUGE download though.) But, if you're wanting syntax highlighting for GDL you probably want to look at something else...?

Codebox looks pretty interesting.

K
One of the forum moderators
AC 28 USA and earlier   •   macOS Sonoma 14.7.1, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Erich
Booster
Karl,
I think that Xcode is overkill for what I am looking for which is basically a code snippet library.

Thus far CodeBox has been very good. The program is light, starts fast, searches fast, and works fairly well for entering GDL snippets. There is a minor bug that prevents the menu item from showing in my case (there is a fix via Terminal, but I have not implemented it yet as my Unix programing skills are very very dusty).

Also, while CodeBox supports syntax highlighting for a huge number of languages, GDL is not one of them (not a big surprise). I contacted the developer and he indicated that the feature could be added, but he does it via a TextMate template and there isn't one for GDL that he or I could find (again not a surprise). Taking a look at TextMate, I was unable to quickly determine how to create such a template. So for now I am using CodeBox in plaintext format without highlighting. Thus far, I do like it.
Erich

AC 19 6006 & AC 20
Mac OS 10.11.5
15" Retina MacBook Pro 2.6
27" iMac Retina 5K
Jochen Suehlo
Moderator
I use Codebox from App Store, which has some nice features, for my GDL snippets (and other code snippets).
It is very simple, but If you do not have hundreds of categories, its quite perfect.
It costs only 4.99 $ and I think its worth the price.

I do not use textmate themes.
But Codebox has an export function to Coda ("open in Coda"), which I use for Web Site editing. Coda has syntax highlighting templates and I have started to build one for GDL (but not finished), so I can print my colored code (for code checking).
Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
Erich
Booster
Joachim,

I am interested to hear how your Coda template comes along. Perhaps you can share examples once it is finished.
Erich

AC 19 6006 & AC 20
Mac OS 10.11.5
15" Retina MacBook Pro 2.6
27" iMac Retina 5K
Jochen Suehlo
Moderator
Erich,
have you noticed that Frank Beister offers a syntax highlight scheme for PROTON on Windows?
http://www.opengdl.org/Home/Tools/Editors/tabid/1933/language/de-DE/Default.aspx

When I ever will be finished with my highlighting for Coda, I will share it on my website.
Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
Anonymous
Not applicable
3NF GDL Scripter is not as versatile as you'd like but if you save your "snippets" as individual files you can patch them together again rather easily. They could probably make it do what you want for a fee.

http://www.3nf.com/en/index.html
owen
Newcomer
CodeBox looked handy and you almost can't go wrong at $5. I can see it becoming quite useful, although that forced me to look at my code management (or lack thereof) yet again ... something i've never really found a satisfactory answer to.

What really caught my attention was the mention of syntax highlighting via TextMate themes - I remembered i had picked up TextMate a while ago but had never really thought about creating a GDL language bundle for it - i guess the software available to me and my desire to do it weren't in the same place at the same time.

So this thread put it back on the radar - I'd bought CodeBox, dusted off TextMate and dug into the documentation. Turns out creating a language bundle (syntax) and theme (highlighting the syntax) is actually relatively simple at least at a basic level. All the work is in the language bundle, which relies heavily on usage of Regular Expressions. Which i know very little about, so that was another thing to dive into.

Anyway on and off over the last couple of days i've put together the beginnings of both a Language Bundle and Theme. It is by no means complete in terms of capturing the full extent of GDL commands available, nor is it 'bug' free - I am attempting to learn Regex at the same time and so there are a few issues i have to figure out around correctly recognising command boundaries. But I think its a solid start and has shown enough potential that i think i will keep going at it.

Short term goals are:

- Styling (highlighting) of all GDL command keywords only (e.g CPRISM_ mat, mat, etc only, not CPRISM_ mat, mat, etc
- Styling of comments [!]
- Collapsing text blocks according to command pairs (e.g ADDX ... DEL 1 can be collapsed to hide code between to aid navigating long nested scripts
- Collapsing blocks based on a made-up comment string ( ! <---etc ... ! >---)

Due to my complete lack of regex 'skillz' I have been forced to assume a certain way of structuring code where GDL is flexible - e.g always using spaces to separate things even though GDL ignores spaces - so Param = X is recognized as two parameters separated with an operator whereas Param=X isn't. The upside to this - for me anyway - is it forces me to be a bit more disciplined in how things are written because they don't work if they aren't. When my knowledge of Regex allows i may go back and fix these restrictions. I've also made-up some of my own 'commands' for the language to enable things like collapsing code blocks based on certain comment strings which in GDL mean nothing, it's all about TextMate at this point.

Anyway .. I've attached the TextMate 'GDL' Language Bundle & 'GDL' Theme along with a sample .gsm (its really just text) you can open in TextMate showing what commands I have semi-working so far.

I will post updates as they come, but feel free to take and do with as you wish. If anyone has any questions, feedback or can offer any guidance (like 'run away!' or 'there be dragons there'...) i'd be glad to hear it.

cheers,

owen
cheers,

Owen Sharp

Design Technology Manager
fjmt | francis-jones morehen thorp

iMac 27" i7 2.93Ghz | 32GB RAM | OS 10.10 | Since AC5
owen
Newcomer
forgot to ask - does anyone know if its possible to add a TextMate language bundle to CodeBox? Seems you can only add the TextMate Themes for highlighting existing languages - not new languages themselves?

image of the sample file below
Screen shot 2011-05-06 at 2.52.22 AM.png
cheers,

Owen Sharp

Design Technology Manager
fjmt | francis-jones morehen thorp

iMac 27" i7 2.93Ghz | 32GB RAM | OS 10.10 | Since AC5
Erich
Booster
Owen,

What a great start. I would suggest that you contact the CodeBox developer directly at codebox AT shpakovski DOT com to see if he can add the support. He seemed more that willing to help when I contacted him initially.
Erich

AC 19 6006 & AC 20
Mac OS 10.11.5
15" Retina MacBook Pro 2.6
27" iMac Retina 5K