"Full featured" and lightweight Rust editor

Hi, I'm using an Odroid N2 for some embedded development (AVR, ARM) on my workbench. This computer only has 4GB of RAM.

I can use VSCode, but it is relatively slow and uses a lot of RAM. I'm looking for a more lightweight editor that has still features like rust-analyzer, Clippy or rustfmt. I tried to set up Neovim, but it is difficult to set it up.

Is there an alternative or is there an easier way to set up Neovim? I'm currently try to compile and set up amp, pepper and helix. At least helix and pepper have lsp support, but not sure about Clippy or rustfmt.

2 Likes

Have you tried using the rust-analyzer language server with neovim? There's a section in the manual for setting it up.

1 Like

you could try this nice lightweight configuration for neovim:

and see in action here:

There is also juCi++
You have to compile it from source, which is strange but it is simple and rust-analyzer works with it out of the box, which is a big plus in my book. Usually complicated setups mean that in practice it probably won't work.

At least that was my experience with trying to run VSCode under WSL (Windows for Linux).

i use sublime text, you can use it free if you don't mind clicking cancel once in a while. it has good lsp support (which i don't use since rust-analyzer takes up a lot of my ram and cpu) using the LSP package, and rust-enhanced package for clippy and rustfmt.

As a slight aside, why not use your main machine and cross compile for the target?

1 Like

As a slight aside, why not use your main machine and cross compile for the target?

Sometimes I like to minimize myself to get focused on what I want to accomplish. No notifications, no way to play games or watch YouTube... Besides, it decelerates you a bit if the PC doesn't react immediately. Also, my main computer is not in my workshop.

i use sublime text, you can use it free if you don't mind clicking cancel once in a while.

Sublime uses Python as extension. I haven't used Sublime, but in my general experience Python addons are slow and memory consuming. I would like to use an editor that is compiled to native binary and doesn't need a garbage collector.

There is also juCi++

That really looks interesting as alternative to VSCode.

Currently I try to set up and learn Helix, which is written in Rust and also has rust-analyzer and tree-sitter support ootb. It lacks documentation, but doesn't look bad so far. Especially tree-sitter seems to be a huge improvement. Even if I want to decelerate myself I don't want to be annoyed by a lacking editor. And I even think about switching from VSCode to Atom because of tree-sitter or use Helix at all.

If I can't handle Helix I will try juCi++. But until now it looks promising.

I also use leftwm as tiling window manager and Alacritty as terminal (both written in Rust), so why not use an editor that is written in Rust too? :wink:

1 Like

I would say, as of today, "full featured" and "lightweight" are incompatible for Rust.

rust-analyzer is a rather heavy-weight thing, especially in terms of RAM usage. It keeps all data in memory, and, unlike rustc, it doesn't do separate compilation -- all the crates are analyzed together.

IntelliJ Rust analysis engine probably can be more light-weight (as it offloads much more stuff from RAM to on-disk indices), but the IntelliJ platform is rather heavy weight itself.

My advice here would probably be to use vanilla sublime text -- they have regex-based indexing of source code out of the box, and that should provide adequate level of functionality with reasonable performance.

An alternative approach is to go with remote development -- VS Code should be lightweight enough to keep the front-end on your machine, and the backend can run on a powerful AWS machine.

8 Likes

I know that rust-analyser is not lightweight, but it is ok for the relatively small projects I have on this machine.

Even VSCode is doable, but noticeable slower than Helix. And in combination with Firefox it gets ever worse. I will replace Firefox with something like Epiphany, just for basic browsing.

For my laptop, a Samsung Chromebook 3 that has similar specs, I more focused on making my install more lightweight. Basics of my setup are Arch as a base, leftwm for a graphical interface (I heard using a compositor can be faster but haven't tried it), feh for a background, alaccritty, dmenu, polybar, pipewire, and the standard Arch kernel (might be faster if you switch to like Zen or something but haven't tried it). Running Firefox and VSCode+Rust Analyzer on decently large projects aren't too much a problem but RAM usage does get into the 80% range when multiple projects are open. CPU usage idles around 20-35% with a project and Firefox open. Biggest thing is that it doesn't freeze a lot like it did when I was on Manjaro XFCE. Don't know if you've already done this kind of thing for your setup or not but it should be good if you're willing to do it.

I have similar software, except that I use the Ubuntu Mate as base, but also leftwm, picom, polybar and dmenu.

Memory usage is ok, except for the Browser. I also use a swap file.

I think, Helix is a good editor for this setup.

Disable graphic environment altogether, use tmux + kakoune maybe? That's what I use. It is somewhat difficult to set up, but if you're interested I can PM you my config.

I fully agree with the use of alacritty. In the alacritty.yml file I set my shell to 'screen'. and everything scrolls so smooth and fast. Full screen 1080p.

I tried this, but then I miss the browser. Sometimes you have to search for a documentation or sample code.

I like to use Lunarvim.
It's fully featured and easy to extend.

I ditched VSCode since I've discovered it. I'm too lazy to config a nice Vim/Neovim setup I've to admit.

Give it a try :smile:

The main reason I don't want to use vim or nvim on the Odroid N2 is, because both use scripting languages for extensions. I know that Lua is fast, especially if you use luajit, but you still have a lot of overhead.

Vim is even worse because vimscript is much slower than luajit.

On a regular PC you might don't notice much difference, but on such a limited hardware you actually have some noticable lagging.

Helix uses rust-analyzer and tree-sitter out of the box and I can notice the difference in performance compared to a similar nvim setup. Especially tree-sitter seems to make a difference.

1 Like

Yeah, can't agree more!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.