about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorVeetaha <gerzoh1@gmail.com>2020-03-07 14:39:42 +0200
committerVeetaha <gerzoh1@gmail.com>2020-03-07 14:39:42 +0200
commit65cecff316e9217eb0f58df189a3f05de5d8d51c (patch)
treecd0c527ac79338d8719a6ce766bf3fd81aaa90f6 /editors/code/src
parent61a4ea25326b794fe64f37fda323fc704a5f96e9 (diff)
downloadrust-65cecff316e9217eb0f58df189a3f05de5d8d51c.tar.gz
rust-65cecff316e9217eb0f58df189a3f05de5d8d51c.zip
vscode: post refactor HintsUpdater (simplify create() -> constructor call)
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/inlay_hints.ts26
1 files changed, 10 insertions, 16 deletions
diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts
index fd7c49c8909..e1a82e03e82 100644
--- a/editors/code/src/inlay_hints.ts
+++ b/editors/code/src/inlay_hints.ts
@@ -13,7 +13,7 @@ export function activateInlayHints(ctx: Ctx) {
             if (!ctx.config.displayInlayHints) {
                 return this.dispose();
             }
-            if (!this.updater) this.updater = HintsUpdater.create(ctx);
+            if (!this.updater) this.updater = new HintsUpdater(ctx);
         },
         dispose() {
             this.updater?.dispose();
@@ -67,25 +67,21 @@ class HintsUpdater implements Disposable {
     private sourceFiles = new Map<string, RustSourceFile>(); // map Uri -> RustSourceFile
     private readonly disposables: Disposable[] = [];
 
-    private constructor(private readonly ctx: Ctx) { }
-
-    static create(ctx: Ctx) {
-        const self = new HintsUpdater(ctx);
-
+    constructor(private readonly ctx: Ctx) {
         vscode.window.onDidChangeVisibleTextEditors(
-            self.onDidChangeVisibleTextEditors,
-            self,
-            self.disposables
+            this.onDidChangeVisibleTextEditors,
+            this,
+            this.disposables
         );
 
         vscode.workspace.onDidChangeTextDocument(
-            self.onDidChangeTextDocument,
-            self,
-            self.disposables
+            this.onDidChangeTextDocument,
+            this,
+            this.disposables
         );
 
         // Set up initial cache shape
-        ctx.visibleRustEditors.forEach(editor => self.sourceFiles.set(
+        ctx.visibleRustEditors.forEach(editor => this.sourceFiles.set(
             editor.document.uri.toString(),
             {
                 document: editor.document,
@@ -94,9 +90,7 @@ class HintsUpdater implements Disposable {
             }
         ));
 
-        self.syncCacheAndRenderHints();
-
-        return self;
+        this.syncCacheAndRenderHints();
     }
 
     dispose() {