Skip to content

Commit

Permalink
Auto merge of rust-lang#13215 - Veykril:toggle-inlay, r=Veykril
Browse files Browse the repository at this point in the history
Remove the toggleInlayHints command from VSCode

Inlay hints are no longer something specifc to r-a as it has been upstreamed into the LSP, we don't have a reason to give the config for this feature special treatment in regards to toggling. There are plenty of other options out there in the VSCode marketplace to create toggle commands/hotkeys for configurations in general which I believe we should nudge people towards instead.
  • Loading branch information
bors committed Sep 12, 2022
2 parents 7a704f2 + 9c97997 commit b54d22d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 34 deletions.
9 changes: 0 additions & 9 deletions editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,6 @@
"title": "Show RA Version",
"category": "rust-analyzer"
},
{
"command": "rust-analyzer.toggleInlayHints",
"title": "Toggle inlay hints",
"category": "rust-analyzer"
},
{
"command": "rust-analyzer.openDocs",
"title": "Open docs under cursor",
Expand Down Expand Up @@ -1643,10 +1638,6 @@
"command": "rust-analyzer.serverVersion",
"when": "inRustProject"
},
{
"command": "rust-analyzer.toggleInlayHints",
"when": "inRustProject"
},
{
"command": "rust-analyzer.openDocs",
"when": "inRustProject"
Expand Down
24 changes: 0 additions & 24 deletions editors/code/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,30 +321,6 @@ export function serverVersion(ctx: Ctx): Cmd {
};
}

export function toggleInlayHints(_ctx: Ctx): Cmd {
return async () => {
const config = vscode.workspace.getConfiguration("editor.inlayHints", {
languageId: "rust",
});

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);
};
}

// Opens the virtual file that will show the syntax tree
//
// The contents of the file come from the `TextDocumentContentProvider`
Expand Down
1 change: 0 additions & 1 deletion editors/code/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ async function initCommonContext(context: vscode.ExtensionContext, ctx: Ctx) {

ctx.registerCommand("ssr", commands.ssr);
ctx.registerCommand("serverVersion", commands.serverVersion);
ctx.registerCommand("toggleInlayHints", commands.toggleInlayHints);

// Internal commands which are invoked by the server.
ctx.registerCommand("runSingle", commands.runSingle);
Expand Down

0 comments on commit b54d22d

Please sign in to comment.