about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2019-12-30 23:40:48 +0100
committerAleksey Kladov <aleksey.kladov@gmail.com>2019-12-30 23:46:13 +0100
commitc65e90f7b8a74fde62a77ad6d1c8d28dfa98502c (patch)
tree5b8d679df9a4ec726bccfdb8df7841d62109ed4e /editors/code/src
parent09649a991d0a9915266e32539de488f5adca0665 (diff)
downloadrust-c65e90f7b8a74fde62a77ad6d1c8d28dfa98502c.tar.gz
rust-c65e90f7b8a74fde62a77ad6d1c8d28dfa98502c.zip
Use Ctx in highlighter
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/highlighting.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts
index 96d550376b1..247673b5c18 100644
--- a/editors/code/src/highlighting.ts
+++ b/editors/code/src/highlighting.ts
@@ -6,11 +6,10 @@ const seedrandom = seedrandom_; // https://github.com/jvandemo/generator-angular
 import * as scopes from './scopes';
 import * as scopesMapper from './scopes_mapper';
 
-import { Server } from './server';
 import { Ctx } from './ctx';
 
 export function activateHighlighting(ctx: Ctx) {
-    const highlighter = new Highlighter();
+    const highlighter = new Highlighter(ctx);
 
     ctx.client.onReady().then(() => {
         ctx.client.onNotification(
@@ -118,6 +117,12 @@ function createDecorationFromTextmate(
 }
 
 class Highlighter {
+    private ctx: Ctx;
+
+    constructor(ctx: Ctx) {
+        this.ctx = ctx;
+    }
+
     private static initDecorations(): Map<
         string,
         vscode.TextEditorDecorationType
@@ -213,7 +218,7 @@ class Highlighter {
             string,
             [vscode.Range[], boolean]
         > = new Map();
-        const rainbowTime = Server.config.rainbowHighlightingOn;
+        const rainbowTime = this.ctx.config.rainbowHighlightingOn;
 
         for (const tag of this.decorations.keys()) {
             byTag.set(tag, []);
@@ -232,13 +237,13 @@ class Highlighter {
                 colorfulIdents
                     .get(d.bindingHash)![0]
                     .push(
-                        Server.client.protocol2CodeConverter.asRange(d.range),
+                        this.ctx.client.protocol2CodeConverter.asRange(d.range),
                     );
             } else {
                 byTag
                     .get(d.tag)!
                     .push(
-                        Server.client.protocol2CodeConverter.asRange(d.range),
+                        this.ctx.client.protocol2CodeConverter.asRange(d.range),
                     );
             }
         }