diff options
author | Aleksey Kladov <[email protected]> | 2020-05-08 08:28:15 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-08 08:28:15 +0100 |
commit | 3bf5ef02c0dc3087fb4cdd0a794892edde359a0d (patch) | |
tree | fa8ea51758c8a8416762431a4e0c8c812a694469 /editors/code/src | |
parent | 6f2f9049dad24681a5e785555f975bfed8138d45 (diff) |
Add master config for inlayHints to make disabling easy
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/config.ts | 1 | ||||
-rw-r--r-- | editors/code/src/inlay_hints.ts | 14 |
2 files changed, 8 insertions, 7 deletions
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(); |