Skip to content

Commit d4a6f20

Browse files
authored
Tree sitter colors: Everything is bold (microsoft#229839)
Fixes microsoft#229823
1 parent 2544a7b commit d4a6f20

File tree

1 file changed

+30
-25
lines changed

1 file changed

+30
-25
lines changed

src/vs/workbench/services/themes/common/colorThemeData.ts

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -918,31 +918,36 @@ export function findMetadata(colorThemeData: ColorThemeData, captureNames: strin
918918
const standardToken = toStandardTokenType(captureNames[captureNames.length - 1]);
919919
metadata |= (standardToken << MetadataConsts.TOKEN_TYPE_OFFSET);
920920

921-
if (themeRule?.settings.fontStyle === 'italic') {
922-
metadata |= FontStyle.Italic | MetadataConsts.ITALIC_MASK;
923-
} else if (themeRule?.settings.fontStyle !== 'bold') {
924-
metadata |= FontStyle.Bold | MetadataConsts.BOLD_MASK;
925-
} else if (typeof tokenStyle?.underline !== 'undefined') {
926-
metadata |= FontStyle.Underline | MetadataConsts.UNDERLINE_MASK;
927-
} else if (typeof tokenStyle?.strikethrough !== 'undefined') {
928-
metadata |= FontStyle.Strikethrough | MetadataConsts.STRIKETHROUGH_MASK;
929-
} else {
930-
if (typeof tokenStyle?.italic !== 'undefined') {
931-
const italicbit = (tokenStyle?.italic ? FontStyle.Italic : 0);
932-
metadata |= italicbit | MetadataConsts.ITALIC_MASK;
933-
}
934-
if (typeof tokenStyle?.bold !== 'undefined') {
935-
const boldBit = (tokenStyle?.bold ? FontStyle.Bold : 0);
936-
metadata |= boldBit | MetadataConsts.BOLD_MASK;
937-
}
938-
if (typeof tokenStyle?.underline !== 'undefined') {
939-
const underlineBit = (tokenStyle?.underline ? FontStyle.Underline : 0);
940-
metadata |= underlineBit | MetadataConsts.UNDERLINE_MASK;
941-
}
942-
if (typeof tokenStyle?.strikethrough !== 'undefined') {
943-
const strikethroughBit = (tokenStyle?.strikethrough ? FontStyle.Strikethrough : 0);
944-
metadata |= strikethroughBit | MetadataConsts.STRIKETHROUGH_MASK;
945-
}
921+
switch (themeRule?.settings.fontStyle) {
922+
case 'italic':
923+
metadata |= FontStyle.Italic | MetadataConsts.ITALIC_MASK;
924+
break;
925+
case 'bold':
926+
metadata |= FontStyle.Bold | MetadataConsts.BOLD_MASK;
927+
break;
928+
case 'underline':
929+
metadata |= FontStyle.Underline | MetadataConsts.UNDERLINE_MASK;
930+
break;
931+
case 'strikethrough':
932+
metadata |= FontStyle.Strikethrough | MetadataConsts.STRIKETHROUGH_MASK;
933+
break;
934+
default:
935+
if (typeof tokenStyle?.italic !== 'undefined') {
936+
const italicbit = (tokenStyle?.italic ? FontStyle.Italic : 0);
937+
metadata |= italicbit | MetadataConsts.ITALIC_MASK;
938+
}
939+
if (typeof tokenStyle?.bold !== 'undefined') {
940+
const boldBit = (tokenStyle?.bold ? FontStyle.Bold : 0);
941+
metadata |= boldBit | MetadataConsts.BOLD_MASK;
942+
}
943+
if (typeof tokenStyle?.underline !== 'undefined') {
944+
const underlineBit = (tokenStyle?.underline ? FontStyle.Underline : 0);
945+
metadata |= underlineBit | MetadataConsts.UNDERLINE_MASK;
946+
}
947+
if (typeof tokenStyle?.strikethrough !== 'undefined') {
948+
const strikethroughBit = (tokenStyle?.strikethrough ? FontStyle.Strikethrough : 0);
949+
metadata |= strikethroughBit | MetadataConsts.STRIKETHROUGH_MASK;
950+
}
946951
}
947952
const foreground = themeRule ? themeRule.settings.foreground : tokenStyle?.foreground;
948953
if (foreground) {

0 commit comments

Comments
 (0)