Tuesday, July 20, 2021 [Tweets] [Favorites]

BBEdit 14

Bare Bones Software (tweet):

BBEdit 14.0 and later feature built-in support for the Language Server Protocol, (occasionally referred to here as “LSP”, not to be confused with Lightspeed Pascal).


Completions supplied by the language server are significantly more accurate and complete than those available using the built-in mechanisms.

If a language server supports the “signature help” feature, BBEdit enables the “Show Parameter Help” command on the Edit menu; choosing this will open a panel providing assistance for filling in function parameters at the current insertion point (if applicable).

If a language server reports issues (errors and warnings) for a file in which you’re editing, ranges corresponding to those issues get highlighted according to their severity, and the corresponding lines are highlighted in the line number bar.


Command-double-click on a word will direct the request to an appropriate language server and perform the equivalent of “Go to Definition”, if possible.

I’m really excited about this, as it enables all sorts of IDE-type features. I’d long hoped that Xcode would add an API to make its indexing information available to external editors. In a way, this is better because it also works with languages not supported by Xcode. It uses an open protocol that’s implemented by various open-source language implementations. If you’re using a custom language, you can write your own LSP server.

As you might expect, to get this working requires installing a server package for each language (links here). C-family languages and Swift “work” out of the box if you have Xcode installed. I put that in quotes because, although the language server is pre-installed and pre-configured:

clangd relies on a “compilation database” which provides necessary information about compiler options and lists the files relevant to the current project workspace. The compilation database is a JSON file named “compile_commands.json” which lives at the root directory of the project.

Without this, it won’t even know what NSString is. There’s a sample shell script that you can set up to generate the compile_commands.json for each Xcode project. Note that this JSON only contains information about the project files and how they’re compiled. It’s not a list of the actual symbols to be indexed, like with ctags, so it does not need to be regenerated frequently.

One issue I ran into is loose C/Objective-C files that aren’t part of an Xcode project. For example, I like to view/search the header files from Apple’s SDKs. It’s not obvious how to generate a compilation database for those files, nor where to put it. So I end up with spurious warnings about types (even intptr_t) and macros (such as API_AVAILABLE) that were declared in an included file. My workaround for this is to configure .h files as Objective-C++ and then turn off LSP for Objective-C++ files. I mostly care about it in .m files, anyway.

The compilation database does not include information about Swift files, and sourcekit-lsp for Swift doesn’t seem to be able to figure out my project structure itself. So, when editing a Swift file, I get live reporting of syntax errors, which is great, but it doesn’t offer completions of symbols from the same framework or know how to find definitions. But neither, thankfully, does it show warnings for symbols that it doesn’t know about.

More new stuff from the release notes:

Notes are mostly like ordinary text documents, except that you don’t have to remember to save them or even make up a name if you don’t want to. BBEdit keeps notes all together in a “notebook”. Notes exist on disk as text files; there’s no secret file format involved.


Added “Repeat Last Command” to the Edit menu.


When dragging an image or an HTML file into a Markdown document, BBEdit will generate appropriately formatted Markdown references.


Added the ability to drag files (not folders) from an FTP/SFTP browser window to the Finder (and other applications that want files). When the item is dropped in its destination, BBEdit will download the file as indicated.


Added “Precompose Unicode” to the Text menu. This command will convert decomposed Unicode pairs (such as a letter followed by a combining accent or diaresis) into a single Unicode character, where possible.


Added a new script attachment point, to provide additional control over the text generated when you drop an image file into a BBEdit editing view.

It also adds language modules for R, Lisp, Go, and Rust—and a nice new icon for Big Sur. This is definitely one of the bigger BBEdit upgrades.

Pricing is unchanged, $50 for new licenses and $30 for upgrades.

See also:


Update (2021-07-26): See also: Hacker News, TidBITS.


If you want certain flags to be always passed to bare source files, it looks like you can drop a compile_flags.txt in your home folder, formatted one flag per line (as per https://clang.llvm.org/docs/JSONCompilationDatabase.html).

For example, mine currently just has "-fmodules" in it, so BBEdit doesn't report errors if I use @import in a file.

(Not sure if this will break things down the road, but it's easy enough to fix if it does.)

@Nate Cool. Maybe I can use that to tell it to always search certain directories for header files.

Stuart Dootson

This page (https://sarcasm.github.io/notes/dev/compilation-database.html) might be useful - gives a number of methods of constructing a compilation database, including (and this might be most useful for ad-hoc file browsing) generating database entries using clang that can then be merged together.

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment