diff options
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/package.json | 16 | ||||
-rw-r--r-- | editors/code/src/config.ts | 1 | ||||
-rw-r--r-- | editors/code/src/inlay_hints.ts | 14 |
3 files changed, 23 insertions, 8 deletions
diff --git a/editors/code/package.json b/editors/code/package.json index eeb3d3513..853fc513b 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -300,6 +300,11 @@ | |||
300 | "default": true, | 300 | "default": true, |
301 | "markdownDescription": "Check with all features (will be passed as `--all-features`)" | 301 | "markdownDescription": "Check with all features (will be passed as `--all-features`)" |
302 | }, | 302 | }, |
303 | "rust-analyzer.inlayHints.enable": { | ||
304 | "type": "boolean", | ||
305 | "default": true, | ||
306 | "description": "Disable all inlay hints" | ||
307 | }, | ||
303 | "rust-analyzer.inlayHints.typeHints": { | 308 | "rust-analyzer.inlayHints.typeHints": { |
304 | "type": "boolean", | 309 | "type": "boolean", |
305 | "default": true, | 310 | "default": true, |
@@ -405,7 +410,7 @@ | |||
405 | "ms-vscode.cpptools" | 410 | "ms-vscode.cpptools" |
406 | ], | 411 | ], |
407 | "default": "auto", | 412 | "default": "auto", |
408 | "description": "Preffered debug engine.", | 413 | "description": "Preferred debug engine.", |
409 | "markdownEnumDescriptions": [ | 414 | "markdownEnumDescriptions": [ |
410 | "First try to use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb), if it's not installed try to use [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).", | 415 | "First try to use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb), if it's not installed try to use [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).", |
411 | "Use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)", | 416 | "Use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)", |
@@ -589,9 +594,18 @@ | |||
589 | "union": [ | 594 | "union": [ |
590 | "entity.name.union" | 595 | "entity.name.union" |
591 | ], | 596 | ], |
597 | "struct": [ | ||
598 | "entity.name.type.struct" | ||
599 | ], | ||
592 | "keyword.unsafe": [ | 600 | "keyword.unsafe": [ |
593 | "keyword.other.unsafe" | 601 | "keyword.other.unsafe" |
594 | ], | 602 | ], |
603 | "keyword": [ | ||
604 | "keyword" | ||
605 | ], | ||
606 | "keyword.controlFlow": [ | ||
607 | "keyword.control" | ||
608 | ], | ||
595 | "variable.constant": [ | 609 | "variable.constant": [ |
596 | "entity.name.constant" | 610 | "entity.name.constant" |
597 | ] | 611 | ] |
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 110e54180..46de922f3 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -94,6 +94,7 @@ export class Config { | |||
94 | 94 | ||
95 | get inlayHints() { | 95 | get inlayHints() { |
96 | return { | 96 | return { |
97 | enable: this.get<boolean>("inlayHints.enable"), | ||
97 | typeHints: this.get<boolean>("inlayHints.typeHints"), | 98 | typeHints: this.get<boolean>("inlayHints.typeHints"), |
98 | parameterHints: this.get<boolean>("inlayHints.parameterHints"), | 99 | parameterHints: this.get<boolean>("inlayHints.parameterHints"), |
99 | chainingHints: this.get<boolean>("inlayHints.chainingHints"), | 100 | chainingHints: this.get<boolean>("inlayHints.chainingHints"), |
diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts index a09531797..a2b07d003 100644 --- a/editors/code/src/inlay_hints.ts +++ b/editors/code/src/inlay_hints.ts | |||
@@ -10,13 +10,13 @@ export function activateInlayHints(ctx: Ctx) { | |||
10 | const maybeUpdater = { | 10 | const maybeUpdater = { |
11 | updater: null as null | HintsUpdater, | 11 | updater: null as null | HintsUpdater, |
12 | async onConfigChange() { | 12 | async onConfigChange() { |
13 | if ( | 13 | const anyEnabled = ctx.config.inlayHints.typeHints |
14 | !ctx.config.inlayHints.typeHints && | 14 | || ctx.config.inlayHints.parameterHints |
15 | !ctx.config.inlayHints.parameterHints && | 15 | || ctx.config.inlayHints.chainingHints; |
16 | !ctx.config.inlayHints.chainingHints | 16 | const enabled = ctx.config.inlayHints.enable && anyEnabled; |
17 | ) { | 17 | |
18 | return this.dispose(); | 18 | if (!enabled) return this.dispose(); |
19 | } | 19 | |
20 | await sleep(100); | 20 | await sleep(100); |
21 | if (this.updater) { | 21 | if (this.updater) { |
22 | this.updater.syncCacheAndRenderHints(); | 22 | this.updater.syncCacheAndRenderHints(); |