Enable Crate Features in Helix Editor With rust-analyzer

Published , with updates on

So you’re using helix, you’re working on a rust crate, and you need to turn a feature flag on. Here’s how:

name = "rust"
features = [ "some_feature" ]

This will enable the feature! Restart helix (or reload config + restart lsp) and you’re good to go. You can also configure anything else you can find in rust-analyzer’s config docs because the config object is just passed right on in to rust-analyzer as json. Just omit the leading rust-analyzer. outer object when you’re putting stuff into the toml here.

For example, here’s what i have in my global languages.toml, to let rust-analyzer run longer and to use clippy:

name = "rust"
timeout = 120
command = "clippy"

If you want, you can also use this file to configure other helix settings on a per-project basis like disabling autoformat or setting indent levels or whatever.