Matt Nemitz

Software developer | London

Smithy mode | Matt Nemitz

Smithy mode

July 05, 2022

Source code available on Github

All hail Emacs

Though I’ve often hopped between editors, Emacs is the one I finally stuck to. One big reason for that is the ease with which new features can be added to it, such as plugins for brand new languages.

Background: What is this language and why use it?

Smithy is an up-and-coming interface definition language developed by AWS. It has a number of interesting features, the coolest of which I think is that it is agnostic to underlying protocol. This means that the same specification for a service can be used to generate servers and clients communicating over HTTP, JSONRPC, or even something custom with protocol buffers.

The IDL space is certainly a bit crowded. Choosing between GRPC, Thrift, and others often comes down to weighing trade-offs of locking in to particular protocols. The aim of Smithy (from my modest experience) is to create a language for specifying services, and allow that definition to be translated not only into different programming languages but also into other types of specification. A single Smithy spec could (at least in theory) yield all of the following:

The fact that Smithy is agnostic to protocol means you can translate your specification into just about any sort of implementation, or other specification language. That said, the tooling is still very much in development, and is mostly only stable for JVM and Typescript code generation (although Rust and others are on the way). OpenAPI generation also works like a charm!

Editor experience (enter this package)

Editor support for Smithy is slowly improving. Before I wrote this package, there was no Emacs mode for it, and the Vim plugin was quite bare-bones. VSCode has a decent plugin but it’s not much better than the Vim one.

Admittedly this package is also very bare-bones. It only supports basic syntax highlighting. My goal for the project however is to introduce another package leveraging the (language server implementation for Smithy)[https://github.com/awslabs/smithy-language-server]. This should enable more advanced autocomplete, go-to-definition, and all sorts of static analysis.