Documentation for Rust Analyzer settings

Hey all, I've looked at the User Manual for the Rust Analyzer, but I haven't really seen anything that touches on how to configure it through a settings.json. I'm currently working with Rust-Analyzer and YouCompleteMe in Neovim, and I am looking into how to configure my lang server, in particular how to turn off the --all-targets option. Is there any documentation I can look at?

1 Like

No, sadly we haven't got to documenting all the settings in editor-independept format properly yet.

The source of truth is here:

VS Code config (with some docs) is here:

Gotcha. Are there any plans to document this for non-vscode editors? If yes, is anybody working on it or can I go and make a PR?

So I figured out the mappings:

Basically, you want to put all of your settings inside

'ls': {
  'rust-analyzer': {
  # settings go here

And they map to json by splitting by _, so for me the checkOnSave_allTargets would map out to

'rust-analyzer': {
  'checkOnSave': {
     'allTargets': True

similarly it seems for all other configuration.

A possible catch is that the rust-analyzer version that comes with YCM might not be up to date, and so your desired settings might not be available. In that case, download the rust-analyzer binary and put it into ~/.cargo/bin for most rustup installations. Then point l:g_ycm_rust_toolchain_rust = '~/.cargo/' in your vim config.

Leaving this here so that if other people look they can find this.


Yes, but, as usual, there are more plans than available work hours.

Here are two tasks that would help

Easy: add 'ls': {'rust-analyzzer': {}} syntax to the manual so that people know where to put settings.

Hard: add support for doc comments to the source of truth, then generate package.json section from it, as well as a dedicated section in the manual. See for how similar things are done.

1 Like

Added somewhat more thorough mentoring insturctions to