742
}
743
744
>
async function _loadColorTheme(extensionResourceLoaderService: IExtensionResourceLoaderService, themeLocation: URI, result: { textMateRules: ITextMateThemingRule[]; colors: IColorMap; semanticTokenRules: SemanticTokenRule[]; semanticHighlighting: boolean }): Promise<any> {
colorThemeData.ts
745
>
if (resources.extname(themeLocation) === '.json') {
746
>
const content = await extensionResourceLoaderService.readExtensionResource(themeLocation);
747
>
const errors: Json.ParseError[] = [];
748
>
const contentValue = Json.parse(content, errors);
749
>
if (errors.length > 0) {
750
return Promise.reject(new Error(nls.localize('error.cannotparsejson', "Problems parsing JSON theme file: {0}", errors.map(e => getParseErrorMessage(e.error)).join(', '))));
752
return Promise.reject(new Error(nls.localize('error.invalidformat', "Invalid format for JSON theme file: Object expected.")));
753
}
755
await _loadColorTheme(extensionResourceLoaderService, resources.joinPath(resources.dirname(themeLocation), contentValue.include), result);
756
}
758
convertSettings(contentValue.settings, result);
759
return null;
760
}
761
>
result.semanticHighlighting = result.semanticHighlighting || contentValue.semanticHighlighting;
colorThemeData.ts
762
>
const colors = contentValue.colors;
763
>
if (colors) {
764
if (typeof colors !== 'object') {
765
return Promise.reject(new Error(nls.localize({ key: 'error.invalidformat.colors', comment: ['{0} will be replaced by a path. Values in quotes should not be translated.'] }, "Problem parsing color theme file: {0}. Property 'colors' is not of type 'object'.", themeLocation.toString())));