From f984ef26528eca686abbb946b3b363dfe6d74822 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 03:33:00 +0100 Subject: Switch impure functional style to pure imperative --- editors/code/src/highlighting.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'editors/code/src/highlighting.ts') diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index 4c2e7f67b..5e9cbe0de 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts @@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient'; import * as seedrandom_ from 'seedrandom'; const seedrandom = seedrandom_; // https://github.com/jvandemo/generator-angular2-library/issues/221#issuecomment-355945207 -import * as scopes from './scopes'; +import { loadThemeColors, TextMateRuleSettings } from './scopes'; import * as scopesMapper from './scopes_mapper'; import { Ctx } from './ctx'; @@ -172,11 +172,13 @@ function initDecorations(): Map< string, vscode.TextEditorDecorationType > { + const themeColors = loadThemeColors(); + const decoration = ( tag: string, textDecoration?: string, ): [string, vscode.TextEditorDecorationType] => { - const rule = scopesMapper.toRule(tag, scopes.find); + const rule = scopesMapper.toRule(tag, it => themeColors.get(it)); if (rule) { const decor = createDecorationFromTextmate(rule); @@ -232,7 +234,7 @@ function initDecorations(): Map< } function createDecorationFromTextmate( - themeStyle: scopes.TextMateRuleSettings, + themeStyle: TextMateRuleSettings, ): vscode.TextEditorDecorationType { const decorationOptions: vscode.DecorationRenderOptions = {}; decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; -- cgit v1.2.3