Skip to content

Commit 49700e4

Browse files
committed
Auto merge of #12967 - jhgg:code/fix-toggle-hints, r=Veykril
[code] make toggleInlayHints understand {off,on}UntilPressed fixes #12964
2 parents 20d6441 + 4b648d8 commit 49700e4

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

editors/code/src/commands.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,22 @@ export function toggleInlayHints(_ctx: Ctx): Cmd {
326326
const config = vscode.workspace.getConfiguration("editor.inlayHints", {
327327
languageId: "rust",
328328
});
329-
const value = !config.get("enabled");
330-
await config.update("enabled", value, vscode.ConfigurationTarget.Global);
329+
330+
const value = config.get("enabled");
331+
let stringValue;
332+
if (typeof value === "string") {
333+
stringValue = value;
334+
} else {
335+
stringValue = value ? "on" : "off";
336+
}
337+
const nextValues: Record<string, string> = {
338+
on: "off",
339+
off: "on",
340+
onUnlessPressed: "offUnlessPressed",
341+
offUnlessPressed: "onUnlessPressed",
342+
};
343+
const nextValue = nextValues[stringValue] ?? "on";
344+
await config.update("enabled", nextValue, vscode.ConfigurationTarget.Global);
331345
};
332346
}
333347

0 commit comments

Comments
 (0)