]> git.lizzy.rs Git - rust.git/blobdiff - editors/code/src/config.ts
Introduce `toggle inlay hints` vscode command
[rust.git] / editors / code / src / config.ts
index 3b2eec8baa70cb3a93d3b93b3f00db7bb5d33736..e8abf8284eb7380c8f641f369c5c006fcba8c776 100644 (file)
@@ -8,7 +8,7 @@ export const NIGHTLY_TAG = "nightly";
 export class Config {
     readonly extensionId = "matklad.rust-analyzer";
 
-    private readonly rootSection = "rust-analyzer";
+    readonly rootSection = "rust-analyzer";
     private readonly requiresReloadOpts = [
         "serverPath",
         "cargo",
@@ -16,6 +16,10 @@ export class Config {
         "files",
         "highlighting",
         "updates.channel",
+        "lens.enable",
+        "lens.run",
+        "lens.debug",
+        "lens.implementations",
     ]
         .map(opt => `${this.rootSection}.${opt}`);
 
@@ -92,9 +96,9 @@ export class Config {
     get askBeforeDownload() { return this.get<boolean>("updates.askBeforeDownload"); }
     get traceExtension() { return this.get<boolean>("trace.extension"); }
 
-
     get inlayHints() {
         return {
+            enable: this.get<boolean>("inlayHints.enable"),
             typeHints: this.get<boolean>("inlayHints.typeHints"),
             parameterHints: this.get<boolean>("inlayHints.parameterHints"),
             chainingHints: this.get<boolean>("inlayHints.chainingHints"),
@@ -107,4 +111,25 @@ export class Config {
             command: this.get<string>("checkOnSave.command"),
         };
     }
+
+    get debug() {
+        // "/rustc/<id>" used by suggestions only.
+        const { ["/rustc/<id>"]: _, ...sourceFileMap } = this.get<Record<string, string>>("debug.sourceFileMap");
+
+        return {
+            engine: this.get<string>("debug.engine"),
+            engineSettings: this.get<object>("debug.engineSettings"),
+            openUpDebugPane: this.get<boolean>("debug.openUpDebugPane"),
+            sourceFileMap: sourceFileMap
+        };
+    }
+
+    get lens() {
+        return {
+            enable: this.get<boolean>("lens.enable"),
+            run: this.get<boolean>("lens.run"),
+            debug: this.get<boolean>("lens.debug"),
+            implementations: this.get<boolean>("lens.implementations"),
+        };
+    }
 }