[themes] code assist insided extended syntax, remove experimental

This commit is contained in:
Martin Aeschlimann 2021-07-25 23:26:01 +02:00
parent 4feb4fd4d9
commit a56263156d
No known key found for this signature in database
GPG key ID: 2609A01E695523E3
4 changed files with 13 additions and 38 deletions

View file

@ -271,8 +271,8 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
this.currentColorTheme.setCustomTokenColors(this.settings.tokenColorCustomizations);
hasColorChanges = true;
}
if (e.affectsConfiguration(ThemeSettings.SEMANTIC_TOKEN_COLOR_CUSTOMIZATIONS) || e.affectsConfiguration(ThemeSettings.TOKEN_COLOR_CUSTOMIZATIONS_EXPERIMENTAL)) {
this.currentColorTheme.setCustomSemanticTokenColors(this.settings.semanticTokenColorCustomizations, this.settings.experimentalSemanticTokenColorCustomizations);
if (e.affectsConfiguration(ThemeSettings.SEMANTIC_TOKEN_COLOR_CUSTOMIZATIONS)) {
this.currentColorTheme.setCustomSemanticTokenColors(this.settings.semanticTokenColorCustomizations);
hasColorChanges = true;
}
if (hasColorChanges) {

View file

@ -6,7 +6,7 @@
import { basename } from 'vs/base/common/path';
import * as Json from 'vs/base/common/json';
import { Color } from 'vs/base/common/color';
import { ExtensionData, ITokenColorCustomizations, ITextMateThemingRule, IWorkbenchColorTheme, IColorMap, IThemeExtensionPoint, VS_LIGHT_THEME, VS_HC_THEME, IColorCustomizations, ISemanticTokenRules, ISemanticTokenColorizationSetting, ISemanticTokenColorCustomizations, IExperimentalSemanticTokenColorCustomizations, IThemeScopableCustomizations, IThemeScopedCustomizations, THEME_SCOPE_CLOSE_PAREN, THEME_SCOPE_OPEN_PAREN, themeScopeRegex, THEME_SCOPE_WILDCARD } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { ExtensionData, ITokenColorCustomizations, ITextMateThemingRule, IWorkbenchColorTheme, IColorMap, IThemeExtensionPoint, VS_LIGHT_THEME, VS_HC_THEME, IColorCustomizations, ISemanticTokenRules, ISemanticTokenColorizationSetting, ISemanticTokenColorCustomizations, IThemeScopableCustomizations, IThemeScopedCustomizations, THEME_SCOPE_CLOSE_PAREN, THEME_SCOPE_OPEN_PAREN, themeScopeRegex, THEME_SCOPE_WILDCARD } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { convertSettings } from 'vs/workbench/services/themes/common/themeCompatibility';
import * as nls from 'vs/nls';
import * as types from 'vs/base/common/types';
@ -349,7 +349,7 @@ export class ColorThemeData implements IWorkbenchColorTheme {
public setCustomizations(settings: ThemeConfiguration) {
this.setCustomColors(settings.colorCustomizations);
this.setCustomTokenColors(settings.tokenColorCustomizations);
this.setCustomSemanticTokenColors(settings.semanticTokenColorCustomizations, settings.experimentalSemanticTokenColorCustomizations);
this.setCustomSemanticTokenColors(settings.semanticTokenColorCustomizations);
}
public setCustomColors(colors: IColorCustomizations) {
@ -393,17 +393,10 @@ export class ColorThemeData implements IWorkbenchColorTheme {
this.customTokenScopeMatchers = undefined;
}
public setCustomSemanticTokenColors(semanticTokenColors: ISemanticTokenColorCustomizations | undefined, experimental?: IExperimentalSemanticTokenColorCustomizations) {
public setCustomSemanticTokenColors(semanticTokenColors: ISemanticTokenColorCustomizations | undefined) {
this.customSemanticTokenRules = [];
this.customSemanticHighlighting = undefined;
if (experimental) { // apply deprecated settings first
this.readSemanticTokenRules(experimental);
const themeSpecificColors = this.getThemeSpecificColors(experimental) as IExperimentalSemanticTokenColorCustomizations;
if (types.isObject(themeSpecificColors)) {
this.readSemanticTokenRules(themeSpecificColors);
}
}
if (semanticTokenColors) {
this.customSemanticHighlighting = semanticTokenColors.enabled;
if (semanticTokenColors.rules) {

View file

@ -12,7 +12,7 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { textmateColorsSchemaId, textmateColorGroupSchemaId } from 'vs/workbench/services/themes/common/colorThemeSchema';
import { workbenchColorsSchemaId } from 'vs/platform/theme/common/colorRegistry';
import { tokenStylingSchemaId } from 'vs/platform/theme/common/tokenClassificationRegistry';
import { ThemeSettings, IWorkbenchColorTheme, IWorkbenchFileIconTheme, IColorCustomizations, ITokenColorCustomizations, IWorkbenchProductIconTheme, ISemanticTokenColorCustomizations, IExperimentalSemanticTokenColorCustomizations, ThemeSettingTarget } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { ThemeSettings, IWorkbenchColorTheme, IWorkbenchFileIconTheme, IColorCustomizations, ITokenColorCustomizations, IWorkbenchProductIconTheme, ISemanticTokenColorCustomizations, ThemeSettingTarget } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { isMacintosh, isWeb, isWindows } from 'vs/base/common/platform';
@ -144,6 +144,8 @@ function tokenGroupSettings(description: string): IJSONSchema {
};
}
const themeSpecificSettingKey = '^\\[[^\\]]*(\\]\\s*\\[[^\\]]*)*\\]$';
const tokenColorSchema: IJSONSchema = {
type: 'object',
properties: {
@ -165,21 +167,13 @@ const tokenColorSchema: IJSONSchema = {
type: 'boolean'
}
},
patternProperties: {
'^\\[[^\\]]*(\\]\\s*\\[[^\\]]*)*\\]$': {
type: 'object'
},
'^[^\\[\\]]*$': {
type: 'object'
}
},
additionalProperties: false
};
const tokenColorCustomizationSchema: IConfigurationPropertySchema = {
description: nls.localize('editorColors', "Overrides editor syntax colors and font style from the currently selected color theme."),
default: {},
allOf: [tokenColorSchema]
allOf: [{ ...tokenColorSchema, patternProperties: { '^\\[': {} } }]
};
const semanticTokenColorSchema: IJSONSchema = {
@ -205,20 +199,13 @@ const semanticTokenColorCustomizationSchema: IConfigurationPropertySchema = {
allOf: [{ ...semanticTokenColorSchema, patternProperties: { '^\\[': {} } }]
};
const experimentalTokenStylingCustomizationSchema: IConfigurationPropertySchema = {
deprecationMessage: nls.localize('editorColors.experimentalTokenStyling.deprecationMessage', 'Use `editor.semanticTokenColorCustomizations` instead.'),
markdownDeprecationMessage: nls.localize('editorColors.experimentalTokenStyling.deprecationMessageMarkdown', 'Use `#editor.semanticTokenColorCustomizations#` instead.'),
default: {},
allOf: [{ $ref: tokenStylingSchemaId }],
};
const tokenColorCustomizationConfiguration: IConfigurationNode = {
id: 'editor',
order: 7.2,
type: 'object',
properties: {
[ThemeSettings.TOKEN_COLOR_CUSTOMIZATIONS]: tokenColorCustomizationSchema,
[ThemeSettings.SEMANTIC_TOKEN_COLOR_CUSTOMIZATIONS]: semanticTokenColorCustomizationSchema,
[ThemeSettings.TOKEN_COLOR_CUSTOMIZATIONS_EXPERIMENTAL]: experimentalTokenStylingCustomizationSchema
[ThemeSettings.SEMANTIC_TOKEN_COLOR_CUSTOMIZATIONS]: semanticTokenColorCustomizationSchema
}
};
@ -233,7 +220,6 @@ export function updateColorThemeConfigurationSchemas(themes: IWorkbenchColorThem
const themeSpecificWorkbenchColors: IJSONSchema = { properties: {} };
const themeSpecificTokenColors: IJSONSchema = { properties: {} };
const themeSpecificSemanticTokenColors: IJSONSchema = { properties: {} };
const experimentalThemeSpecificSemanticTokenColors: IJSONSchema = { properties: {} };
const workbenchColors = { $ref: workbenchColorsSchemaId, additionalProperties: false };
const tokenColors = { properties: tokenColorSchema.properties, additionalProperties: false };
@ -243,13 +229,14 @@ export function updateColorThemeConfigurationSchemas(themes: IWorkbenchColorThem
themeSpecificWorkbenchColors.properties![themeId] = workbenchColors;
themeSpecificTokenColors.properties![themeId] = tokenColors;
themeSpecificSemanticTokenColors.properties![themeId] = semanticTokenColorSchema;
experimentalThemeSpecificSemanticTokenColors.properties![themeId] = { $ref: tokenStylingSchemaId, additionalProperties: false };
}
themeSpecificWorkbenchColors.patternProperties = { [themeSpecificSettingKey]: workbenchColors };
themeSpecificTokenColors.patternProperties = { [themeSpecificSettingKey]: tokenColors };
themeSpecificSemanticTokenColors.patternProperties = { [themeSpecificSettingKey]: semanticTokenColorSchema };
colorCustomizationsSchema.allOf![1] = themeSpecificWorkbenchColors;
tokenColorCustomizationSchema.allOf![1] = themeSpecificTokenColors;
semanticTokenColorCustomizationSchema.allOf![1] = themeSpecificSemanticTokenColors;
experimentalTokenStylingCustomizationSchema.allOf![1] = experimentalThemeSpecificSemanticTokenColors;
configurationRegistry.notifyConfigurationSchemaUpdated(themeSettingsConfiguration, tokenColorCustomizationConfiguration);
}
@ -299,10 +286,6 @@ export class ThemeConfiguration {
return this.configurationService.getValue<ISemanticTokenColorCustomizations>(ThemeSettings.SEMANTIC_TOKEN_COLOR_CUSTOMIZATIONS);
}
public get experimentalSemanticTokenColorCustomizations(): IExperimentalSemanticTokenColorCustomizations | undefined {
return this.configurationService.getValue<IExperimentalSemanticTokenColorCustomizations>(ThemeSettings.TOKEN_COLOR_CUSTOMIZATIONS_EXPERIMENTAL);
}
public async setColorTheme(theme: IWorkbenchColorTheme, settingsTarget: ThemeSettingTarget): Promise<IWorkbenchColorTheme> {
await this.writeConfiguration(ThemeSettings.COLOR_THEME, theme.settingsId, settingsTarget);
return theme;

View file

@ -31,7 +31,6 @@ export enum ThemeSettings {
COLOR_CUSTOMIZATIONS = 'workbench.colorCustomizations',
TOKEN_COLOR_CUSTOMIZATIONS = 'editor.tokenColorCustomizations',
SEMANTIC_TOKEN_COLOR_CUSTOMIZATIONS = 'editor.semanticTokenColorCustomizations',
TOKEN_COLOR_CUSTOMIZATIONS_EXPERIMENTAL = 'editor.tokenColorCustomizationsExperimental',
PREFERRED_DARK_THEME = 'workbench.preferredDarkColorTheme',
PREFERRED_LIGHT_THEME = 'workbench.preferredLightColorTheme',