Code refactoring in Zed #8623
Replies: 6 comments
-
|
Although a completely different workflow, Zed provides a versatile tool called multi-buffers that allows you to perform various project-wide operations, including refactoring. There's an official Zed demo where Antonio shows how he goes about refactoring a Rust struct usage across his project. |
Beta Was this translation helpful? Give feedback.
-
|
+1 on this, that is the main reason for me not switching to Zed :) |
Beta Was this translation helpful? Give feedback.
-
|
The partial solution above, multi-buffers, don't address the full power of refactors in IntelliJ. In IntelliJ, there's a "move to another file" refactor, which moves an item (struct, fn, enum) to another file, automatically updating all the imports in the process. This is a huge feature that's missing for me and prevents me from switching to Zed full time. |
Beta Was this translation helpful? Give feedback.
-
|
I 100% agree that refactoring would be a huge thing for Zed. |
Beta Was this translation helpful? Give feedback.
-
|
The problem with implementing code refactorings is that it would need to be implemented for each language and this requires a lot of work and polylingual expertise. The LSP protocol only specifies simple refactorings that do not require much user input or user interface, so language servers and code actions cannot be leveraged. Did the developers of Zed considered inventing their own refactoring protocol? It is too early to judge with any confidence, but I suspect the authors can be in somewhat suitable position to, at least, think about it for the future. For such protocol to gain popularity, the code editor itself would have to become popular, so that language server authors would have interest in implementing it. Out of the most popular code editors1:
Atom used to be the most popular3, not so far mentioned, open-source editor. If Zed is in the same spirit, it has a potential to gain traction and help such protocol become widely adopted. Some details about attempts to work around the limited protocol can probably be learned from the creators of Wrangler4. Footnotes |
Beta Was this translation helpful? Give feedback.
-
|
Not being able to A common use case is where an LLM has completed some code. It's functionally working and an okay first draft - but now I need to clean it up, write tests and make it my own. The first thing I'll do is make some different decisions about the layout of the code and move various classes to different modules. This is super-fast and easy to do in PyCharm - it's a very manual and error-prone process in Zed. So I have to fire PyCharm up again :/ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
One of my favorite aspects of JetBrains IDEs is their robust refactoring functionality. The ability to search for references when changing filenames, class names, configurations, or variables is invaluable. This is a major reason I prefer JetBrains over VS Code. Their search tools for finding text and files are also excellent, but that's a separate discussion.
I've reviewed the Zed roadmap (https://zed.dev/roadmap) and don't see any specific plans to enhance refactoring capabilities. While I generally agree with the 'less is more' philosophy, I believe refactoring tools are a core IDE feature. It would be ideal if either plugin developers or the Zed core team could implement these improvements. What are your thoughts on this?

Beta Was this translation helpful? Give feedback.
All reactions