aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeivan Heidari <[email protected]>2019-11-10 21:30:53 +0000
committerSeivan Heidari <[email protected]>2019-11-10 21:30:53 +0000
commit3886164bcce734825d20a1af08ce359fbe0710e3 (patch)
tree1033d15c2aefff9d907f2f0017bcfb9d4b429835
parent83a33fbbeae9cbec8bec855e9338b7ccd08bd3a0 (diff)
Probably a better approach to check for values before assigning lest we replace something.
-rw-r--r--editors/code/src/highlighting.ts30
1 files changed, 27 insertions, 3 deletions
diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts
index 14199dbea..0a38c9ef6 100644
--- a/editors/code/src/highlighting.ts
+++ b/editors/code/src/highlighting.ts
@@ -30,9 +30,33 @@ function createDecorationFromTextmate(
30): vscode.TextEditorDecorationType { 30): vscode.TextEditorDecorationType {
31 const decorationOptions: vscode.DecorationRenderOptions = {}; 31 const decorationOptions: vscode.DecorationRenderOptions = {};
32 decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; 32 decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen;
33 decorationOptions.color = themeStyle.foreground; 33
34 decorationOptions.backgroundColor = themeStyle.background; 34 if (themeStyle.foreground) {
35 decorationOptions.fontStyle = themeStyle.fontStyle; 35 decorationOptions.color = themeStyle.foreground;
36 }
37
38 if (themeStyle.background) {
39 decorationOptions.backgroundColor = themeStyle.background;
40 }
41
42 if (themeStyle.fontStyle) {
43 const parts: string[] = themeStyle.fontStyle.split(' ');
44 parts.forEach(part => {
45 switch (part) {
46 case 'italic':
47 decorationOptions.fontStyle = 'italic';
48 break;
49 case 'bold':
50 decorationOptions.fontWeight = 'bold';
51 break;
52 case 'underline':
53 decorationOptions.textDecoration = 'underline';
54 break;
55 default:
56 break;
57 }
58 });
59 }
36 return vscode.window.createTextEditorDecorationType(decorationOptions); 60 return vscode.window.createTextEditorDecorationType(decorationOptions);
37} 61}
38 62