Chocolat

Screen Shot 2014-01-07 at 4.46.16 PM
Chocolat is an ambitious programmer’s text editor, but it falls short (at least right now) in lots of little ways. E.g. integrating web-based documentation is a nice touch, but what about jQuery?

I discovered Chocolat by accident a month or so back. I can’t exactly remember how I learned about it — I saw a reference to it when reading the documentation of another product I use (I think it might have been Ulysses III) and so I gave it a spin. There was — and remains — a terrible problem with the way Chocolat identifies symbols in Javascript files, and I got into a bit of an argument with one of the developers on github over it, and set it aside. The thing is, Chocolat is an opinionated piece of software, and the downside of that is that one might not like all the opinions. E.g. in their FAQ is the question “will you add a minimap?” the answer to which is “Never!” That said, I like most of Chocolat’s opinions.

Well, there’s a new MacHeist “nano” bundle out and it’s particularly interesting for developers since it includes Hype (the would-be HTML5-based Flash replacement), Chocolat (a new programmer’s text editor which has a lot of potential), and — if some unknown number of people buy the bundle — PaintCode. I should mention that I bought the bundle for PaintCode and then realized it wasn’t actually included. Grrr. Oh well, Chocolat for $20 is actually a pretty good deal.

Here’s what differentiates Chocolat from my two favorite text editors (BBEdit and Sublime) right now:

Chocolat's symbol map is great when it works.
Chocolat’s symbol map is great when it works.
Chocolat tries to show a "symbol map" of your source file, but can't cope with code modules wrapped in anonymous functions (which unfortunately means most well-written Javascript library code). Note the empty rectangle where symbols should be.
Sadly, Chocolat can’t cope with code modules wrapped in anonymous functions (which unfortunately means most well-written Javascript library code). Apparently there are no functions in this source file.
  • Chocolat displays a symbol map (i.e. a list of object and function definitions you can use for quickly navigating source files) — the map is nice, but functionally it’s inferior to BBEdit (which can find symbols declared inside anonymous functions). Espresso remains the best in this respect, since it not only finds all the symbols you could ask for, it displays a nice symbol map too.

Screen Shot 2014-01-07 at 5.03.38 PM

  • Rather than giving you the choice of viewing two files side-by-side or one file, Chocolat lets you look at as many files as you care to side-by-side simply by selecting them.
  • Chocolat attempts to autocomplete Javascript (and does a pretty good job of it, including inferring the expected types for function parameters, and allowing you to tab around auto-inserted method calls TextMate-style). The only downside is that only works on currently open files. I imagine it’s even better with Obj-C (but haven’t tried).

Screen Shot 2014-01-07 at 5.07.14 PM

  • Chocolat attempts to integrate Safari (complete with debugging tools) by displaying it side-by-side with your code. This works pretty well.
  • Chocolat attempts to provide integrated documentation (e.g. select queryGetSelectorAll in a Javascript file and hit Command-Shift-J and it will look it up on MDN and show the documentation side-by-side with your code.
  • Chocolat does not attempt to integrate source control (git, hg, svn, p4, etc.) — I actually like this because I don’t want my text editor to do source control.

 

8 errors. Thanks.
8 errors. Um, ok. Thanks, I guess.

 

  • Chocolat is scriptable via Node.js. (Sublime is scriptable via Python, which is awesome too, but doesn’t happen to be the language I code in every day.) So far the available “mixins” seem pretty primitive (e.g. the jshint mixin tells me that there are “12 errors” in a file, but gives me no clue where or what they are).

For a while I thought Chocolat was a bit sluggish, so I started checking for signs of bloat. I did a quick comparison and BBEdit is actually the leanest of the three editors at 26MB on disk; Sublime 2 is 27MB, Sublime 3 is 28MB, and Chocolat is 34MB. Espresso, incidentally, is 18MB. But it turns out that the problem is I was using a “slow monitor” (i.e. my third monitor which is hooked up using one of those USB dongles). After comparing Chocolat, BBEdit, and Sublime on this display I concluded that BBEdit is even more awesome than I realized (because it appears to do minimal screen updates when scrolling), Chocolat is not bad at all, and Sublime is actually the worst. Again — avoid using USB-powered displays for editing text and you won’t care.

So here’s how it looks right now: Chocolat has the potential to become my favorite text editor since it’s heavily based on Javascript which means anything it doesn’t do well right now I can probably fix if I care to. BBEdit is the most polished, but the hardest to customize. Sublime remains — of course — the coolest, although given that Chocolat has support for both side-by-side editing, supports TextMate themes and snippets, and has “vim mode” it might take that crown, at least on Mac OS X.

But, Chocolat’s multi-file search is far inferior to BBEdit’s (it’s about on par with Sublime’s), its Regex support is also signficantly inferior to BBEdit’s, and it has no diff support (whereas BBEdit is my preferred tool for resolving differences between source files) — although I’m perfectly happy to use BBEdit as a dedicated diff front end, and do my text editing elsewhere.

Chocolat ★★★★ is $49 normally, currently available as part of Macheist Nanobundle 4 ($20).

I may review some of the other apps in the bundle later. In particular I have strong — mostly negative — opinions of Hype and Intensity Pro.

My favorite text editors for web development

I’ve been neck-deep in web development for the last eight months or so during which I’ve been hopping between three different text editors — Webstorm, Sublime Text 2, and BBEdit 10.5. I thought I’d post some thoughts on what the good and bad aspects of each are.

Webstorm

Webstorm ★★★★★ is the web-flavored version of Jetbrains highly-regarded IDE. Despite, I believe, being written in Java it feels light and while not native its UI is solid. It has lots of nice features including jshint/jslint integration (which could be better) and pretty intelligent auto-complete (which is no mean feat for Javascript projects).

  • Very capable. Cluttered.
  • Doesn’t feel quite as lightweight as Sublime or BBEdit, but it’s very nimble compared to (say) Eclipse.
  • File-browser + Tabs seems wasteful of screen real-estate. I’d rather waste space on tabs than file paths.
  • Ridiculously configurable, which is a mixed blessing.
  • Project-centric to an annoying degree (e.g. you can’t just create a scratch document you don’t plan to save anywhere).
  • jshint/jslint and refactoring suggestions integrated into the editor (UI is very fiddly, but the integration can be very helpful).

Sublime Text 2

Sublime Text 2 ★★★★★ (version 3 is in testing) is flavor of the month in text editor world. Since version 2 came to the Mac it seems to have taken over most of Textmate’s mindshare (and deservedly so, it’s a far better product in most respects than Textmate ever was).

I should note that while I’ve played around with Sublime Text a fair bit, and admire it, I don’t actually use it for anything serious and haven’t actually licensed it (in part it’s because I’m waiting to see if version 3 addresses my few complaints).

  • Side-by-side editors are awesome, and great use of widescreen display.
  • Great tab implementation.
  • Nice modeless search, including multi-file search.
  • Lots of cool features such as multi-select-editing that I don’t use.
  • Minimap is a cute but generally useless gimmick.
  • Go to Anything… is awesome.
  • Ctrl-M to jump to matching braces is awesome.

BBEdit 10.5

BBEdit 10.5 ★★★★★ is the crusty old man of Mac text editing, having started life in the 608×0 era and yet having managed to weather the storm of many rivals to make it to the current day. (I first got BBEdit as a free bundle with Dreamweaver 1.0 which, at the time, couldn’t actually edit text files worth a damn, and instead would “round-trip” HTML source to BBEdit).

  • Popup menus for open files and functions in the current file are incredibly useful, but clunky. I tabs and keyboard-driven alternatives would be better respectively (there is a keyboard alternative to the open file popup, but it doesn’t differentiate between opened and unopened files).
  • Modeless search is cute but lacks features of and integration with regular search (e.g. regexp support).
  • Aging UI. E.g. I don’t understand why the Search and Multi-File Search dialogs aren’t the same dialog.
  • Best Regexp implementation I’ve seen in any editor, including remembering previous searches, ability to save queries, and full documentation.
  • Best Multi-File Search implementation I’ve ever seen in any editor (but it’s driven by modal dialogs and search results windows)
  • Most of the time when I see someone using a cool feature in some other editor (e.g. Sublime’s “Go to Anything…” shortcut) I discover BBEdit also has Open File by Name (which isn’t quite as smart).
  • Double-click to select contents of matching braces is even awesomer.

In the end, despite some quirks of its aging interface, I find BBEdit to be my go-to editor, but I envy the elegance and utility of Sublime’s basic UI and modeless search and Webstorm’s auto-complete (I’d also miss Webstorm’s jshint integration, but we’ve actually built jshint integration into our project documentation and it works even better). As always, I hope the next versions of my favorite editors will address my complaints and add new enviable features.

Kaleidoscope.app

Image Comparison in Kaleidoscope (images from LostGarden)

Sofa, the developers of Versions (a rather nice subversion client I don’t use) — among many other things, have just announced a new diff utility called Kaleidoscope. (Of course I was immediately reminded of an old app for customizing Mac OS Classic’s system colors). They’re selling it for €29.

The Mac is not short of perfectly good diff tools for text files. Apple provides a pretty good one (FileMerge) for free, although its UI is a bit spartan, and of course there’s diff if you aren’t afraid of the command line. My current favorites are BBEdit and Subversion’s built-in difference tools. BBEdit’s is not so graphical but has the excellent advantage of showing a list of differences which you can click through. Cornerstone’s is simple, attractive, and has the enormous advantage of being integrated with version control (so you can compare a file against an older version that isn’t actually on your hard disk, or compare two old versions to see where a critical change took place).

This is all well and good, but Kaleidoscope offers what might be a killer feature — image comparison. While Cornerstone lets you view versions of an image side-by-side, Kaleidoscope offers “difference” and “splitter” views. (The “difference” composite mode from Photoshop essentially renders abs( pixel_from_a – pixel_from_b ), giving you bright white where the layers are different and black where they are the same.) Unfortunately, this feature is treated almost as an afterthought and since it’s something any Cocoa programmer could whip up in a few minutes (CoreImage offers this compositing option “for free” — and, look it’s provided as a fully working example from Apple) it’s a bit of a shame.

Kaleidoscope does have a pretty nice UI. It has a tabbed interface and lots of animated transitions. If it actually provided useful functionality, and weren’t ridiculously overpriced, it might be quite tempting.

And finally, it begs the question, does this mean that Versions still doesn’t have integrated diff?