BBEdit/Textwrangler LCM for livescript
James Hale
james at thehales.id.au
Tue Sep 8 01:20:41 EDT 2015
I contacted BBEdit re getting the newer version of the CLMs working and had some success and some failure.
Success: Keywords now broken up into classes with a different colour for each class.
Failure: multi word keywords are not possible with the CLM
Control structure folding is thus not possible either (cannot tell "end if" from "end repeat" as it can't handle multi word keys)
I originally contacted Rich as I was getting a BBEdit console error stating that there were no keywords and hence color syntax would not work. As it turns out, the error message is bogus and the colorsyntax wasn't working due to another bug. I will let Rich explain.
> As to the coloring generally: the module is constructed correctly, but the default colors aren't being loaded because of an obscure math bug that arose out of the need to support some legacy preferences. Fortunately, you can work around this permanently as follows: in each case where your language module specifies a color as "rgb(R, G, B)", you can rewrite this as a four-component RGBA color: "rgba(r, g, b, a)", where each component in the rgba color is computed by dividing the respective component in the RGB color by 256.0, and the "a" component is always 1.0. Thus:
>
> <key>com.barebones.bblm.livescript.commands</key>
> <string>rgb(110, 50, 200)</string>
>
> would become:
>
> <key>com.barebones.bblm.livescript.commands</key>
> <string>rgba(0.43, 0.19, 0.78, 1.0)</string>
So I have updated the LCM to now separate the keywords into the following:
properties
operators
objects
messages
keywords
functions
constants
commands
controls
and given each a different color! (Well if its there, use it :-))
As a bonus, as these are named sets they appear in the "Text Colors" pane of the BBEdit preferences, so you can change them to your liking without the need to do the maths and edit the .plist (NB: for some reason the "controls" set does not show in the pref pane.)
I have uploaded the revised livescript.plist.
https://dl.dropboxusercontent.com/u/8212901/Livescript.plist
James
james at thehales.id.au
Tel: +61 3 9386 2516
Fax: +61 3 9386 1387
More information about the use-livecode
mailing list