about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-04-16 05:10:17 +0000
committerbors <bors@rust-lang.org>2022-04-16 05:10:17 +0000
commit66c232d03baadecf5318a77837f0f8b6166c0796 (patch)
tree1deb3b365f4cd594e62ab2421bf6c3eb24d960f3
parent1c22537b3b7012f76952546ef90b18509a056690 (diff)
parentf77adb3a232eb612771436565e21e62ab2cd86e1 (diff)
downloadrust-66c232d03baadecf5318a77837f0f8b6166c0796.tar.gz
rust-66c232d03baadecf5318a77837f0f8b6166c0796.zip
Auto merge of #12006 - lnicola:toggle-inlay-hints, r=lnicola
fix: Remove old inlay hints settings

Closes #11998
-rw-r--r--docs/user/manual.adoc6
-rw-r--r--editors/code/src/commands.ts10
-rw-r--r--editors/code/src/config.ts13
3 files changed, 8 insertions, 21 deletions
diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc
index 84dc6552484..27f10da1032 100644
--- a/docs/user/manual.adoc
+++ b/docs/user/manual.adoc
@@ -722,7 +722,7 @@ Just add this to your `settings.json`:
 {
   "editor.inlayHints.fontFamily": "Courier New",
   "editor.inlayHints.fontSize": 11,
-  
+
   "workbench.colorCustomizations": {
     // Name of the theme you are currently using
     "[Default Dark+]": {
@@ -797,8 +797,8 @@ For example:
 [source,json]
 ----
 {
-  "key": "ctrl+i",
-  "command": "rust-analyzer.toggleInlayHints",
+  "key": "ctrl+alt+d",
+  "command": "rust-analyzer.openDocs",
   "when": "inRustProject"
 }
 ----
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index 4b2ac448018..18f5b3aa101 100644
--- a/editors/code/src/commands.ts
+++ b/editors/code/src/commands.ts
@@ -298,12 +298,12 @@ export function serverVersion(ctx: Ctx): Cmd {
     };
 }
 
-export function toggleInlayHints(ctx: Ctx): Cmd {
+export function toggleInlayHints(_ctx: Ctx): Cmd {
     return async () => {
-        await vscode
-            .workspace
-            .getConfiguration(`${ctx.config.rootSection}.inlayHints`)
-            .update('enable', !ctx.config.inlayHints.enable, vscode.ConfigurationTarget.Global);
+        const scope = vscode.ConfigurationTarget.Global;
+        const config = vscode.workspace.getConfiguration("editor.inlayHints");
+        const value = !config.get("enabled");
+        await config.update('enabled', value, scope);
     };
 }
 
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index 5d3ef404594..183521c10c5 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -97,19 +97,6 @@ export class Config {
     get serverExtraEnv() { return this.get<Env | null>("server.extraEnv") ?? {}; }
     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"),
-            closureReturnTypeHints: this.get<boolean>("inlayHints.closureReturnTypeHints"),
-            hideNamedConstructorHints: this.get<boolean>("inlayHints.hideNamedConstructorHints"),
-            smallerHints: this.get<boolean>("inlayHints.smallerHints"),
-            maxLength: this.get<null | number>("inlayHints.maxLength"),
-        };
-    }
-
     get cargoRunner() {
         return this.get<string | undefined>("cargoRunner");
     }