JavaScript syntax highlighting

196 views
Skip to first unread message

scg

unread,
Dec 16, 2017, 9:59:32 PM12/16/17
to BBEdit Talk
I suspect there's an obvious solution to this, but I haven't been able to find it yet.

BBEdit's JavaScript syntax highlighting doesn't seem to pick up newer features ('let', 'for...of', template literals, etc.). I thought there might be a language module available somewhere for this (e.g. an ES6/ECMAScript 2015 module), but I haven't found anything.

Is there a way to get BBEdit to include these features in its syntax highlighting? (I'm currently using the free version, although I'm still in the trial period, so I think all features should be available.)

Thanks.

Jim Danner

unread,
Dec 18, 2017, 8:18:55 AM12/18/17
to BBEdit Talk
One way to do this (which is what I did): in ~/Library/Application Support/BBEdit/Custom Keywords  (create the directory if it doesn't exist), put a new file with file extension .js in which you put any keywords that are currently lacking, each on its own line. For example, I have a file called JavaScript.js with as its contents
let
of
ObjectId
Enter code here...
but you could put in other ES6 keywords.

scg

unread,
Dec 19, 2017, 11:21:38 AM12/19/17
to BBEdit Talk
Thank you! That worked perfectly. Presumably template literals can't be addressed that way, but I guess one would probably have to dig deeper for something like that (e.g. by creating a custom language module).

Jon

unread,
Apr 3, 2018, 2:20:17 PM4/3/18
to BBEdit Talk
Thanks, Jim. This works fine with JavaScript. However, I have had no success with PicoLisp (.l) and Dart (.dart). I tried to install the AutoLISP language module; that gave me highlighting of some Lisp words, but the extra words I had put into my words.l file in the Custom Keywords directory had no effect.
I'm a big fan of BBEdit, and I hope that one day there will be syntax support for Dart, and maybe also (Pico)Lisp.

/Jon

Jon

unread,
Apr 3, 2018, 4:17:08 PM4/3/18
to BBEdit Talk
After having had a closer look at the AutoLISP language module, and another one, I understand a little more. If I find the time and inspiration, I may try to write a language module myself. ;-)

Alfredo

unread,
Dec 22, 2020, 12:36:44 PM12/22/20
to BBEdit Talk
Jon,

Did you manage to get anything for Dart?

Thanks.

Alfredo

Reply all
Reply to author
Forward
0 new messages