From 3bf5ef02c0dc3087fb4cdd0a794892edde359a0d Mon Sep 17 00:00:00 2001
From: Aleksey Kladov <aleksey.kladov@gmail.com>
Date: Fri, 8 May 2020 09:28:15 +0200
Subject: Add master config for inlayHints to make disabling easy

---
 editors/code/src/config.ts      |  1 +
 editors/code/src/inlay_hints.ts | 14 +++++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)

(limited to 'editors/code/src')

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 {
 
     get inlayHints() {
         return {
+            enable: this.get<boolean>("inlayHints.enable"),
             typeHints: this.get<boolean>("inlayHints.typeHints"),
             parameterHints: this.get<boolean>("inlayHints.parameterHints"),
             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) {
     const maybeUpdater = {
         updater: null as null | HintsUpdater,
         async onConfigChange() {
-            if (
-                !ctx.config.inlayHints.typeHints &&
-                !ctx.config.inlayHints.parameterHints &&
-                !ctx.config.inlayHints.chainingHints
-            ) {
-                return this.dispose();
-            }
+            const anyEnabled = ctx.config.inlayHints.typeHints
+                || ctx.config.inlayHints.parameterHints
+                || ctx.config.inlayHints.chainingHints;
+            const enabled = ctx.config.inlayHints.enable && anyEnabled;
+
+            if (!enabled) return this.dispose();
+
             await sleep(100);
             if (this.updater) {
                 this.updater.syncCacheAndRenderHints();
-- 
cgit v1.2.3