Zed Weekly: #18

September 5th, 2023

This week at Zed, we boosted the semantic index's throughput and consistency and introduced an amazing inline assistant in our AI efforts. As we refine channel notes and search features, we're prepping for major UI infrastructure changes.


This week, we've been improving the semantic index which is key to integrating user context into Antonio's inline assistant project. Notably, we've adjusted our batching function to batch based on token count instead of number of spans. This allow us to batch fragments of files asynchronously while maintaining the integrity of atomic file writes inside our semantic index. This heavily reduces the number of OpenAI requests, boosts throughput and enhances the consistency of the engine.

We also implemented an embeddings cache to avoid the costly process of re-embedding all treesitter spans each time a file is saved. This process sent redundant OpenAI requests for unchanged spans, and wasted compute resources, slowing down the engine. Our new cache removes this redundancy, and decreases the token count during incremental indexing by roughly 75%. This vital improvement was one of the last items we aimed to implement before expanding the semantic features in the app. We'll likely finalize indexing functionality over this coming week, before focusing on use cases to leverage this engine throughout Zed.


I've been pretty busy poking at additional channel features, not much to report yet. This week I'm back to working on turning our channel trees into DAGs though, so there should be more next week :D


We're landing Tailwind this week (huge thanks to Julia & Kirill) so I spent a bunch of time this week putting it through its paces, pointing out nits, and generally trying to break it. We caught a couple of things that will come in the following weeks.

Beyond that, I've been working on some behind the scenes UI stuff in preparation of some of our big UI infra changes that are coming down the line. Ya'll might see a pause in visual changes for the next few weeks as we land some big behind the scene changes that will enable us to write UI much faster.


This week, I've continued work on channel notes - collaboratively-editable markdown files hosted in the cloud, which are associated with each Zed channel. Specifically, I've been working on allowing you to seamlessly reconnect to a channel notes buffer if you temporarily lose internet connection.


Exciting times for AI integration in Zed: we've merged the first iteration of the inline assistant, which will hit stable tomorrow. As Kyle mentioned, we have now been working on the semantic index to allow providing more relevant context when generating code.


Outside of my daily community duties, I spent more time in Python land this week. I noticed some issues with our script that generates our key bindings documentation, so I put a bit of time into correcting it. I was also able to spend a bit of time working on my feedback tool side project, feedback_commander.

Feedback Commander
Feedback Commander

This thing is still in its infancy and clearly needs a lot of attention; the UI will need to be built up and AI capabilities will need to be added after that. The current UI is basically the bare minimum needed to debug the backend.

Working in Python continues to give me more perspective what sort of friction exists in this world within Zed. One thing that has quickly become a pain is having to manually activate virtual environments every time a terminal is launched, so I collaborated with the team to land initial support for automatic virtual environment activation in Zed (available in v0.102). Zed will check in the root of your project for a virtual environment directory and activate it. Settings have been provided to allow customizing the possible paths to check for virtual environments and for which activate script to run. These can be configured globally to work one way and then overridden on a per-project basis if needed.

There is a lot of work to do in this space, but I'm thinking my next Zed-Python adventure will be adding some initial Poetry support.


Main thing of the week was Tailwind completions: me and Julia pushed it to a deliverable state, where multiple language servers (including Tailwind) can provide completions in different web contexts (css part of html file, pure js file, etc.). That seems to be a start of a bigger work on the web development front, let's see how far it will get us.

Overall, experimenting with multiple language servers at once lead to a few quality of life improvements:

  • rust-analyzer got a couple more PRs, one of them should improve inlay hints' load by removing excessive server /refresh requests
  • Zed's language server log panel now shows servers' stderr and soon will allow clearning the logs
  • carets in Zed windows that lost the focus do not blink anymore, multiple open LSP projects on the screen are now less distractful and utilize less resources
  • in the background, I'm slowly working on the ability to override existing language servers with local copies

Next week, I plan to work with Julia on web tooling more, supporting prettier in Zed. I really hope this work paves a road to plugins in Zed.


This week I got search improvements over the finish line. I am not stopping there though; throughout the latter half of the week I have worked on "replace in buffer". In fact it is mostly ready, sans styling and figuring out the UI. I believe it is fair to say that it should land sometime in September. I plan to release it separately from replace in project, which I did not look into yet.