about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-04-20 04:38:22 +0000
committerbors <bors@rust-lang.org>2022-04-20 04:38:22 +0000
commit34c3e0b0672f8a2bed571b844f1ace6f83f5fae3 (patch)
tree9ff2f75f1b4046530b9565f9f0d01469b3218fa2
parent55824021e10d296a10948549e49a5bdc8dc1c661 (diff)
parentad751e08ec653eb856c598ab2b9402b3051eeda4 (diff)
downloadrust-34c3e0b0672f8a2bed571b844f1ace6f83f5fae3.tar.gz
rust-34c3e0b0672f8a2bed571b844f1ace6f83f5fae3.zip
Auto merge of #12037 - lnicola:inlay-hint-config, r=lnicola
fix: Remove `rust-analyzer.inlayHints.enable` and set language scope

Closes #12036
CC https://github.com/rust-lang/rust-analyzer/issues/12027#issuecomment-1102990324

The key was left there by mistake in #12006.

Setting the configuration scope only works if you already have it created, which is fine, but unfortunately not quite discoverable.
-rw-r--r--editors/code/package.json5
-rw-r--r--editors/code/src/commands.ts5
2 files changed, 2 insertions, 8 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 60c827e31ab..cd0ad92d9a5 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -293,11 +293,6 @@
                     "default": null,
                     "markdownDescription": "Environment variables passed to the runnable launched using `Test` or `Debug` lens or `rust-analyzer.run` command."
                 },
-                "rust-analyzer.inlayHints.enable": {
-                    "type": "boolean",
-                    "default": true,
-                    "description": "Whether to show inlay hints."
-                },
                 "rust-analyzer.server.path": {
                     "type": [
                         "null",
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index a808d5ec6d8..1e89938c052 100644
--- a/editors/code/src/commands.ts
+++ b/editors/code/src/commands.ts
@@ -300,10 +300,9 @@ export function serverVersion(ctx: Ctx): Cmd {
 
 export function toggleInlayHints(_ctx: Ctx): Cmd {
     return async () => {
-        const scope = vscode.ConfigurationTarget.Global;
-        const config = vscode.workspace.getConfiguration("editor.inlayHints");
+        const config = vscode.workspace.getConfiguration("editor.inlayHints", { languageId: "rust" });
         const value = !config.get("enabled");
-        await config.update('enabled', value, scope);
+        await config.update('enabled', value, vscode.ConfigurationTarget.Global);
     };
 }