From 5dab5e737909532e4a65390541393af6ee72f65b Mon Sep 17 00:00:00 2001 From: veetaha Date: Mon, 25 May 2020 03:47:33 +0300 Subject: Introduce `toggle inlay hints` vscode command Users now can assign a shortcut for this command via the general vscode keybindings ui or `keybinding.json file` Closes: #4599 --- editors/code/src/commands/index.ts | 1 + editors/code/src/commands/toggle_inlay_hints.ts | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 editors/code/src/commands/toggle_inlay_hints.ts (limited to 'editors/code/src/commands') diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts index abb53a248..c2a232d5f 100644 --- a/editors/code/src/commands/index.ts +++ b/editors/code/src/commands/index.ts @@ -16,6 +16,7 @@ export * from './expand_macro'; export * from './runnables'; export * from './ssr'; export * from './server_version'; +export * from './toggle_inlay_hints'; export function collectGarbage(ctx: Ctx): Cmd { return async () => ctx.client.sendRequest(ra.collectGarbage, null); diff --git a/editors/code/src/commands/toggle_inlay_hints.ts b/editors/code/src/commands/toggle_inlay_hints.ts new file mode 100644 index 000000000..7606af8d0 --- /dev/null +++ b/editors/code/src/commands/toggle_inlay_hints.ts @@ -0,0 +1,11 @@ +import * as vscode from 'vscode'; +import { Ctx, Cmd } from '../ctx'; + +export function toggleInlayHints(ctx: Ctx): Cmd { + return async () => { + await vscode + .workspace + .getConfiguration(`${ctx.config.rootSection}.inlayHints`) + .update('enable', !ctx.config.inlayHints.enable, vscode.ConfigurationTarget.Workspace); + }; +} -- cgit v1.2.3