Recently I have been making a point to use Zed's built-in AI assistant during my day-to-day coding. It's no secret that I'm a bit of an AI skeptic, but I want to keep an open mind and give AI the chance to impress me.
What follows are some accounts of recent instances where Zed's AI integration has left me feeling impressed.
Writing docs with AI
In the past two weeks the team has been hosting what we've affectionately termed "docs parties" where we all hang out for an hour or two and document the various bits of Zed's codebase.
During one of these parties I found myself needing to document two structs with the same fields: an internal settings struct and a separate struct for serialization. One of these structs had its fields documented while the other did not:
While I could have copied the doc comments over by hand, this struct had 16 fields and the imbalance of lines in each doc comment would have made a multi-cursor maneuver a bit tricky.
I decided to enter this prompt into the inline assistant to see what would happen:
Copy the doc comments from the fields in
LanguageSettingsContent
and add them to the fields inLanguageSettings
. Ignore the note about the default value. Just bring over the doc comments.
The AI copied over the doc comments verbatim—sans the note about the default value that I asked it to ignore—and put them on the corresponding fields:
Translating code with AI
In my spare time I've been rebuilding the bones of my personal website. As part of this, I need to translate my templates from Tera over to a new templating system I'm building on top of auk
.
I needed to port this small component I had written over to Auk's DSL:
Once again, I thought it would be interesting to see what the Zed assistant could do with this. I prompted it with:
Rewrite this HTML using
auk
's DSL like thepost_link
function above.
The end result that the assistant spit out looked identical to what I would have produced by hand:
I was especially struck by the ease at which the assistant was able to adapt to this brand-new DSL that I had created. By simply composing in the same buffer as a few other examples, the AI was able to piece together enough of the context to correctly form.
Since discovering that the Zed assistant is quite adept at converting between Tera and Auk, I've continued using it over the course of the migration to cut down on the manual grunt work. At time of writing there are almost 1,300 lines of Auk template code, the majority of which were written with the help of the AI assistant:
While I still don't buy into the notion that AI will make software developers obsolete, these experiences have convinced me there is definitely room for a judicious integration of AI into our development tools and workflows.
At Zed we're exploring what it would look like to harness the power of AI to empower developers as they write software, and we're just getting started.
This post originally appeared on maxdeviant.com.