mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-15 14:43:58 +00:00
[code] make toggleInlayHints understand {off,on}UntilPressed
This commit is contained in:
parent
634cfe3d72
commit
4b648d8f6c
1 changed files with 16 additions and 2 deletions
|
@ -326,8 +326,22 @@ export function toggleInlayHints(_ctx: Ctx): Cmd {
|
||||||
const config = vscode.workspace.getConfiguration("editor.inlayHints", {
|
const config = vscode.workspace.getConfiguration("editor.inlayHints", {
|
||||||
languageId: "rust",
|
languageId: "rust",
|
||||||
});
|
});
|
||||||
const value = !config.get("enabled");
|
|
||||||
await config.update("enabled", value, vscode.ConfigurationTarget.Global);
|
const value = config.get("enabled");
|
||||||
|
let stringValue;
|
||||||
|
if (typeof value === "string") {
|
||||||
|
stringValue = value;
|
||||||
|
} else {
|
||||||
|
stringValue = value ? "on" : "off";
|
||||||
|
}
|
||||||
|
const nextValues: Record<string, string> = {
|
||||||
|
on: "off",
|
||||||
|
off: "on",
|
||||||
|
onUnlessPressed: "offUnlessPressed",
|
||||||
|
offUnlessPressed: "onUnlessPressed",
|
||||||
|
};
|
||||||
|
const nextValue = nextValues[stringValue] ?? "on";
|
||||||
|
await config.update("enabled", nextValue, vscode.ConfigurationTarget.Global);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue