提交 7744c445 编写于 作者: M Martin Aeschlimann

[semantic highlighting] functions in josef.rouge-theme get wrong color. Fixes #92536

上级 18567cdc
......@@ -293,9 +293,11 @@ export class ColorThemeData implements IWorkbenchColorTheme {
const settings = tokenColors[i].settings;
if (score >= foregroundScore && settings.foreground) {
foreground = settings.foreground;
foregroundScore = score;
}
if (score >= fontStyleScore && types.isString(settings.fontStyle)) {
fontStyle = settings.fontStyle;
fontStyleScore = score;
}
}
}
......@@ -657,7 +659,7 @@ function nameMatcher(identifers: string[], scope: ProbeScope): number {
let lastScopeIndex = scope.length - 1;
let lastIdentifierIndex = findInIdents(scope[lastScopeIndex--], identifers.length);
if (lastIdentifierIndex >= 0) {
const score = (lastIdentifierIndex + 1) * 0x10000 + scope.length;
const score = (lastIdentifierIndex + 1) * 0x10000 + identifers[lastIdentifierIndex].length;
while (lastScopeIndex >= 0) {
lastIdentifierIndex = findInIdents(scope[lastScopeIndex--], lastIdentifierIndex);
if (lastIdentifierIndex === -1) {
......
......@@ -289,6 +289,41 @@ suite('Themes - TokenStyleResolving', () => {
});
test('resolveScopes - match most specific', async () => {
const themeData = ColorThemeData.createLoadedEmptyTheme('test', 'test');
const customTokenColors: ITokenColorCustomizations = {
textMateRules: [
{
scope: 'entity.name.type',
settings: {
fontStyle: 'underline',
foreground: '#A6E22E'
}
},
{
scope: 'entity.name.type.class',
settings: {
foreground: '#FF00FF'
}
},
{
scope: 'entity.name',
settings: {
foreground: '#FFFFFF'
}
},
]
};
themeData.setCustomTokenColors(customTokenColors);
const tokenStyle = themeData.resolveScopes([['entity.name.type.class']]);
assertTokenStyle(tokenStyle, ts('#FF00FF', { underline: true }), 'entity.name.type.class');
});
test('rule matching', async () => {
const themeData = ColorThemeData.createLoadedEmptyTheme('test', 'test');
themeData.setCustomColors({ 'editor.foreground': '#000000' });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册