TruerWords Logo

Search TruerWords

Sign Up  Log On

“BBEdit 8.5.1's JavaScript Support”

From: Seth Dillingham In Response To: Top of Thread.  
Date Posted: Thursday, October 12, 2006 2:21:34 PM Replies: 0
Enclosures: None.

Bare Bones just announced the release of BBEdit 8.5.1. This is basically a release of "bug fixes and feature tweaks," but there's some cool stuff in there that some people will certainly enjoy playing with (myself included).

Comparison of the function popup for the same JavaScript file in 8.2.6, 8.5, and 8.5.1:

BBEdit 8.2.6
BBEdit 8.2.6

BBEdit 8.5
BBEdit 8.5

BBEdit 8.5.1
BBEdit 8.5.1

(Ahem. See my BBEdit Disclaimer, please.)

As I've mentioned, I did some work for Bare Bones on the 8.5 release, and the same is true for 8.5.1 (just a small part of the total work, in both cases, but it feels significant to me). What I "didn't yet get around to" is that my favorite part of this project has been the new JavaScript support! I totally rewrote it from scratch for 8.5, and then enhanced it a bit for 8.5.1. (The story of how this came about is pretty cool, but there's no room for it here. For now, let it suffice to say that it involved food and a bit of personal challenge.)

The significant, JavaScript-related changes that a user would notice, between 8.2.6 and 8.5, include the following:

  • More keywords are recognized and colored.

  • Much better detection of functions for the function popup menu.

  • Recognition of "anonymous" functions (again, for the function popup menu.)

  • Folding. (I didn't write BBEdit's folding feature, I just hooked it up in the JavaScript support.)

Even before 8.5 had shipped, I was working on some improvements. I had this crazy idea that I could make BBEdit's JavaScript support as complete as possible, to the point that I would actually feel like it was "done." (Is software ever done?)

Here's what was added for 8.5.1:

  • Function names in the function popup are now complete. That is, it doesn't just grab the last word of the name. (See the third picture on the right.)

  • Folding improvements. Rather than adding automatic "fold points" only at the start/end of functions, they're added to all matched sets of {curly braces} that contain at least N lines (N defaults to 4, but can be set via a hidden preference from the command line).

  • Object literals are listed in the function popup, if they have names. The names are found in the same way as function names, so long.dotted().names work, too. Plus, nested objects and functions are listed "hierarchically" in the function popup, and objects are marked with a special character so you can scan the menu quickly to find the objects you need.

  • Since Prototype is so wildly popular these days, we added support for Prototype's "Object.extend" as another way to 'name' an object.

    Not clear on that one? Here's an example:

    Object.extend( foo.prototype, { ... } )

    ... produces an entry in the function popup menu called "foo.prototype"

  • You can add arbitrary strings ("place markers") to your JavaScripts, in comments, and they're added to the function popup. For example, this comment:

    // #mark Hello World

    ... causes a "Hello World" entry to be added to the function popup. I personally find this very useful for breaking a long file up into "labeled" parts. Plus, if the mark is just a single hyphen (so, "#mark -") then a standard menu-separator is added to the popup menu.

There are tons of other little improvements in 8.5.1, unrelated to JavaScript. A few of them I worked on, most of them I had nothing to do with. (Meaning, of course, Bare Bones did it themselves.) For me, this is "the JavaScript release," as I think this makes BBEdit a really great JavaScript editor. (But then, I *would* think that!)

Discussion Thread:

There are no replies.


There are no trackbacks.

is Seth Dillingham's
personal web site.
Truer words were never spoken.