Rust, helix, filetree, goto def, rename, fill in match (with enum arms)

Is anyone here using Helix for Rust ?

I am considering switching form IntelliJ, but not finding how to do these basic tasks:

  1. filetree (like neotree in neovim)

  2. goto def, rename var

  3. on a match x { ... } hit some key and fill in all arms when x is an enum

Anyone with a helix setup with all 3 of the above working ?

1 Like

I am using Helix at work. I’ve also contributed a little bit to it in the past.

Not implemented, and not planned as a core feature of the editor.
See:

However, the plugin system is on its way. There is a demo here. That being said, there is no eta for the plugin system. I think you should not make a decision thinking it will be available in the next month.

Works flawlessly using LSP and rust-analyzer. g + d and <space> + r. See the documentation for the default keymap.

Same as above. This is a code action provided by rust-analyzer.

4 Likes

I agree with everything @CBenoit said and just wanted to add that at least you can open a directory. It will list files in all nested directories and you can filter in the search box.

@CBenoit @jumpnbrownweasel

How are you dealing with the lack of a file tree? Is it (1) fuzzy search, (2) some type of filetree in a zellij panel which notifies the running helix which file to open, or (3) something else ?

I turns out I feel comfortable working with nothing more than the (fuzzy) file picker and stopped using a file tree long ago even in other editors. I like having nothing but code in front of me. Also, thanks to rust-analyzer, it’s possible to create files for new modules using a code action (mod mymodule + code action => create file mymodule.rs / or create file mymodule/mod.rs). However, it’s true that Helix will not help much if you’re going to create and move around a lot of files frequently. In such cases, I open a new shell in another terminal and type commands directly there or use a dedicated tool such as broot. I’m using a tiling window manager, so this is all very straightforward and natural operations. I think this workflow could be improved in a few ways if I could integrate more tools directly into Helix, but I don’t feel less productive than I used to be with vim/neovim/emacs/kakoune previously. This is likely due to the fact that these other "file system heavy" tasks are not what I need to do the most in my day-to-day. It also helps that Rust tooling is very friendly to such setups. When I need to write C# code the experience is not so fun. (At least, I didn’t try to use Helix too much in big C# codebases so far, but maybe it can be tuned further.) This is for reasons unrelated to the absence of a file tree however.

The fuzzy search.

Is there a way to limit the file picker <space> f to only show *.rs and *.toml files ?

.ignore file in the directory hx runs from

How many crates are you dealing with in your workspace? In my experience, I can navigate within a crate fine using IntelliJ/VIM keys, but when dealing with lots (50+) crates in a workspace, I really want a filetree.

In IronRDP, I have to deal with 30+ crates. I don’t think we have any repository with more than 50 crates at work.

I just open the picker and type .rs or .toml. Not perfect because the fuzzy matcher may show files with other extensions (at the end), but typically enough for most intents and purposes.

Broot may be a better alternative when exploring a big workspace.

EDIT: by the way, I recommend the Helix GitHub discussions section or the Helix matrix room if you are looking for more answers. To be honest, I don’t know all features of Helix and you may get more information there.

1 Like