8

I upgraded my Rust environment via rustup update recently, then my VSCode reports an error each time I open my editor. Two repeated windows pop up at the bottom right corner of the editor, showing that

Duplicated RLS configuration: rustfmt_path:rustfmt_path,rustfmt_path,,
Source: Rust (rls) (Extension)

I can open VSCode's default settings.json and indeed find duplicated entries, but I'm not able to delete them.

Restarting the extension can reproduce the problem, and I don't even know if the plugin itself is working properly or not.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
Fei
  • 1,450
  • 1
  • 17
  • 30
  • Do you have two Rust extensions installed and enabled by any chance? – Chris Dawe Apr 26 '19 at 18:41
  • Might be the case but I don't know which extension added duplicated entries in default settings.json – Fei Apr 28 '19 at 08:32
  • I have both rls and racer installed, is that a possible cause? Note this problem wasn't seen before, so it is more like a rust tool chain issue than vscode issue. – Fei May 12 '19 at 01:18

2 Answers2

14

I've been through the same problem. I am not exactly sure of the proper solution but these workarounds have solved my problem.

  1. Remove all VSCode extensions that are Rust-related.
  2. Remove any Rust-related configuration in VSCode settings.json.
  3. If you are using Linux and you have done a lot of playing around, sometimes $HOME/.cargo/registry may be corrupt, so remove that folder if it helps.
  4. Restart VSCode.
  5. Install these extensions in order:

    • Rust RLS official extension

      Do not install Rust kalitaalexey (Seems to be the conflicting cause).

    • Rust Assist extension.

    • vscode-rust-syntax extension.

    • vsc-rustfmt extension.

    • Cargo extension.

    • Better TOML

The combination of these extensions work OK for me. Specifically, the syntax formatting works with Ctrl+Shift+I and saving the file automatically does that.

One last hint: Opening 2 Rust project folders in VSCode at the same time may cause an error message that states Unable to find root directory. Try to avoid that.

Arto Kalishian
  • 496
  • 1
  • 6
  • 11
1

You most likely have two VS Code extensions installed that do the same thing. That was at least the problem in my case.

Uninstall the extension Rust by kalitaalexey and keep the "official" extension Rust (rls) maintained by the Rust Language development team.

Emanuel Lindström
  • 1,607
  • 16
  • 25