diff --git a/README.md b/README.md index f7afaff..599187c 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,30 @@ NOTE: On Windows, you can install it using [choco](https://chocolatey.org/instal No other packages or manual setup is required as these will be handled with user prompts after install. However, you may wish to install `rustup` with your OS package manager instead of following prompts to install via [rustup.rs](https://rustup.rs). +## Configure rust-analyzer + +**rust-analyzer** settings can be stored in a JSON file in the project directory. + +It first looks for `rust-analyzer.json`. +If the file does not exists, it then checks `.config/rust-analyzer.json`. + +### Example + +`.config/rust-analyzer.json` + +```json +{ + "cargo": { + "loadOutDirsFromCheck": true, + }, + "procMacro": { + "enable": true, + } +} +``` + +Refer to the [rust-analyzer User Manual](https://rust-analyzer.github.io/manual.html#configuration) for the supported config options. + ## Commands - `ide-rust:restart-all-language-servers` Restart all currently active Rls processes diff --git a/lib/index.js b/lib/index.js index bdd00d9..d29a16a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -474,6 +474,10 @@ class RustLanguageClient extends AutoLanguageClient { let rlsConfigPath = path.join(projectPath, "rust-analyzer.json") + if (!fs.existsSync(rlsConfigPath)) { + rlsConfigPath = path.join(projectPath, ".config/rust-analyzer.json") + } + if (fs.existsSync(rlsConfigPath)) { try { let options = fs.readFileSync(rlsConfigPath)