提交 d7cbceae 编写于 作者: A Alex Dima

Fixes #40706: Align Inspect TM Scopes widget implementation with the runtime one

上级 f6feb041
......@@ -273,7 +273,7 @@ class InspectTMScopesWidget extends Disposable implements IContentWidget {
let theme = this._themeService.getColorTheme();
result += `<hr class="tm-metadata-separator"/>`;
let matchingRule = findMatchingThemeRule(theme, data.tokens1[token1Index].scopes);
let matchingRule = findMatchingThemeRule(theme, data.tokens1[token1Index].scopes, false);
if (matchingRule) {
result += `<code class="tm-theme-selector">${matchingRule.rawSelector}\n${JSON.stringify(matchingRule.settings, null, '\t')}</code>`;
} else {
......
......@@ -7,11 +7,11 @@
import { IColorTheme, ITokenColorizationSetting } from 'vs/workbench/services/themes/common/workbenchThemeService';
export function findMatchingThemeRule(theme: IColorTheme, scopes: string[]): ThemeRule {
export function findMatchingThemeRule(theme: IColorTheme, scopes: string[], onlyColorRules: boolean = true): ThemeRule {
for (let i = scopes.length - 1; i >= 0; i--) {
let parentScopes = scopes.slice(0, i);
let scope = scopes[i];
let r = findMatchingThemeRule2(theme, scope, parentScopes);
let r = findMatchingThemeRule2(theme, scope, parentScopes, onlyColorRules);
if (r) {
return r;
}
......@@ -19,13 +19,13 @@ export function findMatchingThemeRule(theme: IColorTheme, scopes: string[]): The
return null;
}
function findMatchingThemeRule2(theme: IColorTheme, scope: string, parentScopes: string[]): ThemeRule {
function findMatchingThemeRule2(theme: IColorTheme, scope: string, parentScopes: string[], onlyColorRules: boolean): ThemeRule {
let result: ThemeRule = null;
// Loop backwards, to ensure the last most specific rule wins
for (let i = theme.tokenColors.length - 1; i >= 0; i--) {
let rule = theme.tokenColors[i];
if (!rule.settings.foreground) {
if (onlyColorRules && !rule.settings.foreground) {
continue;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册