Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Move config files to avoid cluttering project root #207

Merged
merged 6 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down