diff options
Diffstat (limited to 'editors/code/src/highlighting.ts')
-rw-r--r-- | editors/code/src/highlighting.ts | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index dad99254e..1c67e5dc3 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import seedrandom = require('seedrandom'); | 1 | import seedrandom = require('seedrandom'); |
2 | import * as vscode from 'vscode'; | 2 | import * as vscode from 'vscode'; |
3 | import * as lc from 'vscode-languageclient'; | 3 | import * as lc from 'vscode-languageclient'; |
4 | import * as scopes from './scopes' | 4 | import * as scopes from './scopes'; |
5 | import * as scopesMapper from './scopes_mapper'; | 5 | import * as scopesMapper from './scopes_mapper'; |
6 | 6 | ||
7 | import { Server } from './server'; | 7 | import { Server } from './server'; |
@@ -25,35 +25,35 @@ function fancify(seed: string, shade: 'light' | 'dark') { | |||
25 | return `hsl(${h},${s}%,${l}%)`; | 25 | return `hsl(${h},${s}%,${l}%)`; |
26 | } | 26 | } |
27 | 27 | ||
28 | |||
28 | function createDecorationFromTextmate(themeStyle: scopes.TextMateRuleSettings): vscode.TextEditorDecorationType { | 29 | function createDecorationFromTextmate(themeStyle: scopes.TextMateRuleSettings): vscode.TextEditorDecorationType { |
29 | const options: vscode.DecorationRenderOptions = {} | 30 | const options: vscode.DecorationRenderOptions = {}; |
30 | options.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen | 31 | options.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; |
31 | if (themeStyle.foreground) { | 32 | if (themeStyle.foreground) { |
32 | options.color = themeStyle.foreground | 33 | options.color = themeStyle.foreground; |
33 | } | 34 | } |
34 | if (themeStyle.background) { | 35 | if (themeStyle.background) { |
35 | options.backgroundColor = themeStyle.background | 36 | options.backgroundColor = themeStyle.background; |
36 | } | 37 | } |
37 | if (themeStyle.fontStyle) { | 38 | if (themeStyle.fontStyle) { |
38 | const parts: string[] = themeStyle.fontStyle.split(' ') | 39 | const parts: string[] = themeStyle.fontStyle.split(' '); |
39 | parts.forEach((part) => { | 40 | parts.forEach((part) => { |
40 | switch (part) { | 41 | switch (part) { |
41 | case 'italic': | 42 | case 'italic': |
42 | options.fontStyle = 'italic' | 43 | options.fontStyle = 'italic'; |
43 | break | 44 | break; |
44 | case 'bold': | 45 | case 'bold': |
45 | options.fontWeight = 'bold' | 46 | options.fontWeight = 'bold'; |
46 | 47 | break; | |
47 | break | ||
48 | case 'underline': | 48 | case 'underline': |
49 | options.textDecoration = 'underline' | 49 | options.textDecoration = 'underline'; |
50 | break | 50 | break; |
51 | default: | 51 | default: |
52 | break | 52 | break; |
53 | } | 53 | } |
54 | }) | 54 | }) |
55 | } | 55 | } |
56 | return vscode.window.createTextEditorDecorationType(options) | 56 | return vscode.window.createTextEditorDecorationType(options); |
57 | } | 57 | } |
58 | 58 | ||
59 | export class Highlighter { | 59 | export class Highlighter { |
@@ -66,7 +66,7 @@ export class Highlighter { | |||
66 | textDecoration?: string | 66 | textDecoration?: string |
67 | ): [string, vscode.TextEditorDecorationType] => { | 67 | ): [string, vscode.TextEditorDecorationType] => { |
68 | 68 | ||
69 | const rule = scopesMapper.toRule(tag, scopes.find) | 69 | const rule = scopesMapper.toRule(tag, scopes.find); |
70 | 70 | ||
71 | if (rule) { | 71 | if (rule) { |
72 | const decor = createDecorationFromTextmate(rule); | 72 | const decor = createDecorationFromTextmate(rule); |