Skip to content

Commit

Permalink
Icon theme JSON parsing changed in 1.96.0 (#236085)
Browse files Browse the repository at this point in the history
* Icon theme JSON parsing changed in 1.96.0

* remove fontCharacter validation for now
  • Loading branch information
aeschli authored Dec 16, 2024
1 parent bac4606 commit 9db572a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/vs/workbench/services/themes/browser/fileIconThemeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { getParseErrorMessage } from '../../../../base/common/jsonErrorMessages.
import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js';
import { IExtensionResourceLoaderService } from '../../../../platform/extensionResourceLoader/common/extensionResourceLoader.js';
import { ILanguageService } from '../../../../editor/common/languages/language.js';
import { fontCharacterRegex, fontColorRegex, fontSizeRegex } from '../common/productIconThemeSchema.js';
import { fontColorRegex, fontSizeRegex } from '../common/productIconThemeSchema.js';
import * as css from '../../../../base/browser/cssValue.js';
import { fileIconSelectorEscape } from '../../../../editor/common/services/getIconClasses.js';

Expand Down Expand Up @@ -424,7 +424,7 @@ export class FileIconThemeLoader {
if (definition.fontColor && definition.fontColor.match(fontColorRegex)) {
body.push(css.inline`color: ${css.hexColorValue(definition.fontColor)};`);
}
if (definition.fontCharacter && definition.fontCharacter.match(fontCharacterRegex)) {
if (definition.fontCharacter) {
body.push(css.inline`content: ${css.stringValue(definition.fontCharacter)};`);
}
const fontSize = definition.fontSize ?? (definition.fontId ? fontSizes.get(definition.fontId) : undefined);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as Json from '../../../../base/common/json.js';
import { ExtensionData, IThemeExtensionPoint, IWorkbenchProductIconTheme, ThemeSettingDefaults } from '../common/workbenchThemeService.js';
import { getParseErrorMessage } from '../../../../base/common/jsonErrorMessages.js';
import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js';
import { fontIdRegex, fontWeightRegex, fontStyleRegex, fontFormatRegex, fontCharacterRegex } from '../common/productIconThemeSchema.js';
import { fontIdRegex, fontWeightRegex, fontStyleRegex, fontFormatRegex } from '../common/productIconThemeSchema.js';
import { isObject, isString } from '../../../../base/common/types.js';
import { ILogService } from '../../../../platform/log/common/log.js';
import { IconDefinition, getIconRegistry, IconContribution, IconFontDefinition, IconFontSource } from '../../../../platform/theme/common/iconRegistry.js';
Expand Down Expand Up @@ -245,7 +245,7 @@ function _loadProductIconThemeDocument(fileService: IExtensionResourceLoaderServ

for (const iconId in contentValue.iconDefinitions) {
const definition = contentValue.iconDefinitions[iconId];
if (isString(definition.fontCharacter) && definition.fontCharacter.match(fontCharacterRegex)) {
if (isString(definition.fontCharacter)) {
const fontId = definition.fontId ?? primaryFontId;
const fontDefinition = sanitizedFonts.get(fontId);
if (fontDefinition) {
Expand Down
3 changes: 0 additions & 3 deletions src/vs/workbench/services/themes/common/iconExtensionPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ export class IconExtensionPoint {
collector.warn(nls.localize('invalid.icons.default.fontPath.extension', "Expected `contributes.icons.default.fontPath` to have file extension 'woff', woff2' or 'ttf', is '{0}'.", fileExt));
return;
}
if (!defaultIcon.fontCharacter.match(fontCharacterRegex)) {
collector.warn(nls.localize('invalid.icons.default.fontCharacter', 'Expected `contributes.icons.default.fontCharacter` to consist of a single character or a \\ followed by a Unicode code points in hexadecimal.')); return;
}
const extensionLocation = extension.description.extensionLocation;
const iconFontLocation = resources.joinPath(extensionLocation, defaultIcon.fontPath);
const fontId = getFontId(extension.description, defaultIcon.fontPath);
Expand Down

0 comments on commit 9db572a

Please sign in to comment.