diff options
author | Aleksey Kladov <[email protected]> | 2019-12-31 02:33:00 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-31 02:33:00 +0000 |
commit | f984ef26528eca686abbb946b3b363dfe6d74822 (patch) | |
tree | 75d70fd728114cf3bee0bea997c9fa6c518ba3df /editors/code/src/highlighting.ts | |
parent | cfb086592995a54828f23734a260d387db9ea926 (diff) |
Switch impure functional style to pure imperative
Diffstat (limited to 'editors/code/src/highlighting.ts')
-rw-r--r-- | editors/code/src/highlighting.ts | 8 |
1 files changed, 5 insertions, 3 deletions
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'; | |||
3 | import * as seedrandom_ from 'seedrandom'; | 3 | import * as seedrandom_ from 'seedrandom'; |
4 | const seedrandom = seedrandom_; // https://github.com/jvandemo/generator-angular2-library/issues/221#issuecomment-355945207 | 4 | const seedrandom = seedrandom_; // https://github.com/jvandemo/generator-angular2-library/issues/221#issuecomment-355945207 |
5 | 5 | ||
6 | import * as scopes from './scopes'; | 6 | import { loadThemeColors, TextMateRuleSettings } from './scopes'; |
7 | import * as scopesMapper from './scopes_mapper'; | 7 | import * as scopesMapper from './scopes_mapper'; |
8 | 8 | ||
9 | import { Ctx } from './ctx'; | 9 | import { Ctx } from './ctx'; |
@@ -172,11 +172,13 @@ function initDecorations(): Map< | |||
172 | string, | 172 | string, |
173 | vscode.TextEditorDecorationType | 173 | vscode.TextEditorDecorationType |
174 | > { | 174 | > { |
175 | const themeColors = loadThemeColors(); | ||
176 | |||
175 | const decoration = ( | 177 | const decoration = ( |
176 | tag: string, | 178 | tag: string, |
177 | textDecoration?: string, | 179 | textDecoration?: string, |
178 | ): [string, vscode.TextEditorDecorationType] => { | 180 | ): [string, vscode.TextEditorDecorationType] => { |
179 | const rule = scopesMapper.toRule(tag, scopes.find); | 181 | const rule = scopesMapper.toRule(tag, it => themeColors.get(it)); |
180 | 182 | ||
181 | if (rule) { | 183 | if (rule) { |
182 | const decor = createDecorationFromTextmate(rule); | 184 | const decor = createDecorationFromTextmate(rule); |
@@ -232,7 +234,7 @@ function initDecorations(): Map< | |||
232 | } | 234 | } |
233 | 235 | ||
234 | function createDecorationFromTextmate( | 236 | function createDecorationFromTextmate( |
235 | themeStyle: scopes.TextMateRuleSettings, | 237 | themeStyle: TextMateRuleSettings, |
236 | ): vscode.TextEditorDecorationType { | 238 | ): vscode.TextEditorDecorationType { |
237 | const decorationOptions: vscode.DecorationRenderOptions = {}; | 239 | const decorationOptions: vscode.DecorationRenderOptions = {}; |
238 | decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; | 240 | decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; |