aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/color_theme.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/color_theme.ts')
-rw-r--r--editors/code/src/color_theme.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/editors/code/src/color_theme.ts b/editors/code/src/color_theme.ts
index 7e10c7f79..a6957a76e 100644
--- a/editors/code/src/color_theme.ts
+++ b/editors/code/src/color_theme.ts
@@ -33,6 +33,7 @@ export class ColorTheme {
33 : typeof rule.scope === 'string' 33 : typeof rule.scope === 'string'
34 ? [rule.scope] 34 ? [rule.scope]
35 : rule.scope; 35 : rule.scope;
36
36 for (const scope of scopes) { 37 for (const scope of scopes) {
37 res.rules.set(scope, rule.settings); 38 res.rules.set(scope, rule.settings);
38 } 39 }
@@ -69,13 +70,13 @@ function loadThemeNamed(themeName: string): ColorTheme {
69 ); 70 );
70 } 71 }
71 72
72 const themePaths = vscode.extensions.all 73 const themePaths: string[] = vscode.extensions.all
73 .filter(isTheme) 74 .filter(isTheme)
74 .flatMap(ext => { 75 .flatMap(
75 return ext.packageJSON.contributes.themes 76 ext => ext.packageJSON.contributes.themes
76 .filter((it: any) => (it.id || it.label) === themeName) 77 .filter((it: any) => (it.id || it.label) === themeName)
77 .map((it: any) => path.join(ext.extensionPath, it.path)); 78 .map((it: any) => path.join(ext.extensionPath, it.path))
78 }); 79 );
79 80
80 const res = new ColorTheme(); 81 const res = new ColorTheme();
81 for (const themePath of themePaths) { 82 for (const themePath of themePaths) {
@@ -96,13 +97,12 @@ function loadThemeFile(themePath: string): ColorTheme {
96 return new ColorTheme(); 97 return new ColorTheme();
97 } 98 }
98 const obj = jsonc.parse(text); 99 const obj = jsonc.parse(text);
99 const tokenColors = obj?.tokenColors ?? []; 100 const tokenColors: TextMateRule[] = obj?.tokenColors ?? [];
100 const res = ColorTheme.fromRules(tokenColors); 101 const res = ColorTheme.fromRules(tokenColors);
101 102
102 for (const include in obj?.include ?? []) { 103 for (const include of obj?.include ?? []) {
103 const includePath = path.join(path.dirname(themePath), include); 104 const includePath = path.join(path.dirname(themePath), include);
104 const tmp = loadThemeFile(includePath); 105 res.mergeFrom(loadThemeFile(includePath));
105 res.mergeFrom(tmp);
106 } 106 }
107 107
108 return res; 108 return res;