Merge #8624
8624: Automatically detect rust library source file map r=vsrs a=vsrs
This PR adds a new possible `rust-analyzer.debug.sourceFileMap` value:
```json
{
"rust-analyzer.debug.sourceFileMap": "auto"
}
```
I did not make it the default because it uses two shell calls (`rustc --print sysroot` and `rustc -V -v`). First one can be slow (https://github.com/rust-lang/rustup/issues/783)
Fixes #8619
Co-authored-by: vsrs <vit@conrlab.com>
This commit is contained in:
@@ -135,8 +135,12 @@ export class Config {
|
||||
}
|
||||
|
||||
get debug() {
|
||||
// "/rustc/<id>" used by suggestions only.
|
||||
const { ["/rustc/<id>"]: _, ...sourceFileMap } = this.get<Record<string, string>>("debug.sourceFileMap");
|
||||
let sourceFileMap = this.get<Record<string, string> | "auto">("debug.sourceFileMap");
|
||||
if (sourceFileMap !== "auto") {
|
||||
// "/rustc/<id>" used by suggestions only.
|
||||
const { ["/rustc/<id>"]: _, ...trimmed } = this.get<Record<string, string>>("debug.sourceFileMap");
|
||||
sourceFileMap = trimmed;
|
||||
}
|
||||
|
||||
return {
|
||||
engine: this.get<string>("debug.engine"),
|
||||
|
||||
Reference in New Issue
Block a user