@codingame/monaco-vscode-theme-service-override 1.82.4 → 1.82.5-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +2 -2
- package/theme.d.ts +7 -0
- package/theme.js +27 -0
- package/vscode/src/vs/workbench/services/themes/browser/fileIconThemeData.js +355 -0
- package/vscode/src/vs/workbench/services/themes/browser/productIconThemeData.js +292 -0
- package/vscode/src/vs/workbench/services/themes/browser/workbenchThemeService.js +744 -0
- package/vscode/src/vs/workbench/services/themes/common/colorThemeData.js +866 -0
- package/vscode/src/vs/workbench/services/themes/common/colorThemeSchema.js +267 -0
- package/vscode/src/vs/workbench/services/themes/common/fileIconThemeSchema.js +305 -0
- package/vscode/src/vs/workbench/services/themes/common/plistParser.js +440 -0
- package/vscode/src/vs/workbench/services/themes/common/productIconThemeSchema.js +96 -0
- package/vscode/src/vs/workbench/services/themes/common/textMateScopeMatcher.js +121 -0
- package/vscode/src/vs/workbench/services/themes/common/themeCompatibility.js +68 -0
- package/vscode/src/vs/workbench/services/themes/common/themeConfiguration.js +374 -0
- package/vscode/src/vs/workbench/services/themes/common/themeExtensionPoints.js +256 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Color } from 'monaco-editor/esm/vs/base/common/color.js';
|
|
2
|
+
import * as colors from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
3
|
+
import * as editorColorRegistry from 'monaco-editor/esm/vs/editor/common/core/editorColorRegistry.js';
|
|
4
|
+
|
|
5
|
+
const settingToColorIdMapping = {};
|
|
6
|
+
function addSettingMapping(settingId, colorId) {
|
|
7
|
+
let colorIds = settingToColorIdMapping[settingId];
|
|
8
|
+
if (!colorIds) {
|
|
9
|
+
settingToColorIdMapping[settingId] = colorIds = [];
|
|
10
|
+
}
|
|
11
|
+
colorIds.push(colorId);
|
|
12
|
+
}
|
|
13
|
+
function convertSettings(oldSettings, result) {
|
|
14
|
+
for (const rule of oldSettings) {
|
|
15
|
+
result.textMateRules.push(rule);
|
|
16
|
+
if (!rule.scope) {
|
|
17
|
+
const settings = rule.settings;
|
|
18
|
+
if (!settings) {
|
|
19
|
+
rule.settings = {};
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
for (const settingKey in settings) {
|
|
23
|
+
const key = settingKey;
|
|
24
|
+
const mappings = settingToColorIdMapping[key];
|
|
25
|
+
if (mappings) {
|
|
26
|
+
const colorHex = settings[key];
|
|
27
|
+
if (typeof colorHex === 'string') {
|
|
28
|
+
const color = ( Color.fromHex(colorHex));
|
|
29
|
+
for (const colorId of mappings) {
|
|
30
|
+
result.colors[colorId] = color;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (key !== 'foreground' && key !== 'background' && key !== 'fontStyle') {
|
|
35
|
+
delete settings[key];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
addSettingMapping('background', colors.editorBackground);
|
|
43
|
+
addSettingMapping('foreground', colors.editorForeground);
|
|
44
|
+
addSettingMapping('selection', colors.editorSelectionBackground);
|
|
45
|
+
addSettingMapping('inactiveSelection', colors.editorInactiveSelection);
|
|
46
|
+
addSettingMapping('selectionHighlightColor', colors.editorSelectionHighlight);
|
|
47
|
+
addSettingMapping('findMatchHighlight', colors.editorFindMatchHighlight);
|
|
48
|
+
addSettingMapping('currentFindMatchHighlight', colors.editorFindMatch);
|
|
49
|
+
addSettingMapping('hoverHighlight', colors.editorHoverHighlight);
|
|
50
|
+
addSettingMapping('wordHighlight', 'editor.wordHighlightBackground');
|
|
51
|
+
addSettingMapping('wordHighlightStrong', 'editor.wordHighlightStrongBackground');
|
|
52
|
+
addSettingMapping('findRangeHighlight', colors.editorFindRangeHighlight);
|
|
53
|
+
addSettingMapping('findMatchHighlight', 'peekViewResult.matchHighlightBackground');
|
|
54
|
+
addSettingMapping('referenceHighlight', 'peekViewEditor.matchHighlightBackground');
|
|
55
|
+
addSettingMapping('lineHighlight', editorColorRegistry.editorLineHighlight);
|
|
56
|
+
addSettingMapping('rangeHighlight', editorColorRegistry.editorRangeHighlight);
|
|
57
|
+
addSettingMapping('caret', editorColorRegistry.editorCursorForeground);
|
|
58
|
+
addSettingMapping('invisibles', editorColorRegistry.editorWhitespaces);
|
|
59
|
+
addSettingMapping('guide', editorColorRegistry.editorIndentGuide1);
|
|
60
|
+
addSettingMapping('activeGuide', editorColorRegistry.editorActiveIndentGuide1);
|
|
61
|
+
const ansiColorMap = ['ansiBlack', 'ansiRed', 'ansiGreen', 'ansiYellow', 'ansiBlue', 'ansiMagenta', 'ansiCyan', 'ansiWhite',
|
|
62
|
+
'ansiBrightBlack', 'ansiBrightRed', 'ansiBrightGreen', 'ansiBrightYellow', 'ansiBrightBlue', 'ansiBrightMagenta', 'ansiBrightCyan', 'ansiBrightWhite'
|
|
63
|
+
];
|
|
64
|
+
for (const color of ansiColorMap) {
|
|
65
|
+
addSettingMapping(color, 'terminal.' + color);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { convertSettings };
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
2
|
+
import * as types from 'monaco-editor/esm/vs/base/common/types.js';
|
|
3
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
4
|
+
import { Extensions } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
|
|
5
|
+
import { textmateColorsSchemaId, textmateColorGroupSchemaId } from './colorThemeSchema.js';
|
|
6
|
+
import { workbenchColorsSchemaId } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
7
|
+
import { tokenStylingSchemaId } from 'vscode/vscode/vs/platform/theme/common/tokenClassificationRegistry';
|
|
8
|
+
import { ThemeSettingDefaults, ThemeSettings } from 'vscode/vscode/vs/workbench/services/themes/common/workbenchThemeService';
|
|
9
|
+
import { isWeb } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
10
|
+
|
|
11
|
+
const configurationRegistry = ( Registry.as(Extensions.Configuration));
|
|
12
|
+
const colorThemeSettingEnum = [];
|
|
13
|
+
const colorThemeSettingEnumItemLabels = [];
|
|
14
|
+
const colorThemeSettingEnumDescriptions = [];
|
|
15
|
+
function formatSettingAsLink(str) {
|
|
16
|
+
return `\`#${str}#\``;
|
|
17
|
+
}
|
|
18
|
+
const colorThemeSettingSchema = {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: ( nls.localize('colorTheme', "Specifies the color theme used in the workbench.")),
|
|
21
|
+
default: isWeb ? ThemeSettingDefaults.COLOR_THEME_LIGHT : ThemeSettingDefaults.COLOR_THEME_DARK,
|
|
22
|
+
enum: colorThemeSettingEnum,
|
|
23
|
+
enumDescriptions: colorThemeSettingEnumDescriptions,
|
|
24
|
+
enumItemLabels: colorThemeSettingEnumItemLabels,
|
|
25
|
+
errorMessage: ( nls.localize('colorThemeError', "Theme is unknown or not installed.")),
|
|
26
|
+
};
|
|
27
|
+
const preferredDarkThemeSettingSchema = {
|
|
28
|
+
type: 'string',
|
|
29
|
+
markdownDescription: ( nls.localize(
|
|
30
|
+
{ key: 'preferredDarkColorTheme', comment: ['{0} will become a link to another setting.'] },
|
|
31
|
+
'Specifies the preferred color theme for dark OS appearance when {0} is enabled.',
|
|
32
|
+
formatSettingAsLink(ThemeSettings.DETECT_COLOR_SCHEME)
|
|
33
|
+
)),
|
|
34
|
+
default: ThemeSettingDefaults.COLOR_THEME_DARK,
|
|
35
|
+
enum: colorThemeSettingEnum,
|
|
36
|
+
enumDescriptions: colorThemeSettingEnumDescriptions,
|
|
37
|
+
enumItemLabels: colorThemeSettingEnumItemLabels,
|
|
38
|
+
errorMessage: ( nls.localize('colorThemeError', "Theme is unknown or not installed.")),
|
|
39
|
+
};
|
|
40
|
+
const preferredLightThemeSettingSchema = {
|
|
41
|
+
type: 'string',
|
|
42
|
+
markdownDescription: ( nls.localize(
|
|
43
|
+
{ key: 'preferredLightColorTheme', comment: ['{0} will become a link to another setting.'] },
|
|
44
|
+
'Specifies the preferred color theme for light OS appearance when {0} is enabled.',
|
|
45
|
+
formatSettingAsLink(ThemeSettings.DETECT_COLOR_SCHEME)
|
|
46
|
+
)),
|
|
47
|
+
default: ThemeSettingDefaults.COLOR_THEME_LIGHT,
|
|
48
|
+
enum: colorThemeSettingEnum,
|
|
49
|
+
enumDescriptions: colorThemeSettingEnumDescriptions,
|
|
50
|
+
enumItemLabels: colorThemeSettingEnumItemLabels,
|
|
51
|
+
errorMessage: ( nls.localize('colorThemeError', "Theme is unknown or not installed.")),
|
|
52
|
+
};
|
|
53
|
+
const preferredHCDarkThemeSettingSchema = {
|
|
54
|
+
type: 'string',
|
|
55
|
+
markdownDescription: ( nls.localize(
|
|
56
|
+
{ key: 'preferredHCDarkColorTheme', comment: ['{0} will become a link to another setting.'] },
|
|
57
|
+
'Specifies the preferred color theme used in high contrast dark mode when {0} is enabled.',
|
|
58
|
+
formatSettingAsLink(ThemeSettings.DETECT_HC)
|
|
59
|
+
)),
|
|
60
|
+
default: ThemeSettingDefaults.COLOR_THEME_HC_DARK,
|
|
61
|
+
enum: colorThemeSettingEnum,
|
|
62
|
+
enumDescriptions: colorThemeSettingEnumDescriptions,
|
|
63
|
+
enumItemLabels: colorThemeSettingEnumItemLabels,
|
|
64
|
+
errorMessage: ( nls.localize('colorThemeError', "Theme is unknown or not installed.")),
|
|
65
|
+
};
|
|
66
|
+
const preferredHCLightThemeSettingSchema = {
|
|
67
|
+
type: 'string',
|
|
68
|
+
markdownDescription: ( nls.localize(
|
|
69
|
+
{ key: 'preferredHCLightColorTheme', comment: ['{0} will become a link to another setting.'] },
|
|
70
|
+
'Specifies the preferred color theme used in high contrast light mode when {0} is enabled.',
|
|
71
|
+
formatSettingAsLink(ThemeSettings.DETECT_HC)
|
|
72
|
+
)),
|
|
73
|
+
default: ThemeSettingDefaults.COLOR_THEME_HC_LIGHT,
|
|
74
|
+
enum: colorThemeSettingEnum,
|
|
75
|
+
enumDescriptions: colorThemeSettingEnumDescriptions,
|
|
76
|
+
enumItemLabels: colorThemeSettingEnumItemLabels,
|
|
77
|
+
errorMessage: ( nls.localize('colorThemeError', "Theme is unknown or not installed.")),
|
|
78
|
+
};
|
|
79
|
+
const detectColorSchemeSettingSchema = {
|
|
80
|
+
type: 'boolean',
|
|
81
|
+
markdownDescription: ( nls.localize(
|
|
82
|
+
{ key: 'detectColorScheme', comment: ['{0} and {1} will become links to other settings.'] },
|
|
83
|
+
'If set, automatically switch to the preferred color theme based on the OS appearance. If the OS appearance is dark, the theme specified at {0} is used, for light {1}.',
|
|
84
|
+
formatSettingAsLink(ThemeSettings.PREFERRED_DARK_THEME),
|
|
85
|
+
formatSettingAsLink(ThemeSettings.PREFERRED_LIGHT_THEME)
|
|
86
|
+
)),
|
|
87
|
+
default: false
|
|
88
|
+
};
|
|
89
|
+
const colorCustomizationsSchema = {
|
|
90
|
+
type: 'object',
|
|
91
|
+
description: ( nls.localize(
|
|
92
|
+
'workbenchColors',
|
|
93
|
+
"Overrides colors from the currently selected color theme."
|
|
94
|
+
)),
|
|
95
|
+
allOf: [{ $ref: workbenchColorsSchemaId }],
|
|
96
|
+
default: {},
|
|
97
|
+
defaultSnippets: [{
|
|
98
|
+
body: {}
|
|
99
|
+
}]
|
|
100
|
+
};
|
|
101
|
+
const fileIconThemeSettingSchema = {
|
|
102
|
+
type: ['string', 'null'],
|
|
103
|
+
default: ThemeSettingDefaults.FILE_ICON_THEME,
|
|
104
|
+
description: ( nls.localize(
|
|
105
|
+
'iconTheme',
|
|
106
|
+
"Specifies the file icon theme used in the workbench or 'null' to not show any file icons."
|
|
107
|
+
)),
|
|
108
|
+
enum: [null],
|
|
109
|
+
enumItemLabels: [( nls.localize('noIconThemeLabel', 'None'))],
|
|
110
|
+
enumDescriptions: [( nls.localize('noIconThemeDesc', 'No file icons'))],
|
|
111
|
+
errorMessage: ( nls.localize('iconThemeError', "File icon theme is unknown or not installed."))
|
|
112
|
+
};
|
|
113
|
+
const productIconThemeSettingSchema = {
|
|
114
|
+
type: ['string', 'null'],
|
|
115
|
+
default: ThemeSettingDefaults.PRODUCT_ICON_THEME,
|
|
116
|
+
description: ( nls.localize('productIconTheme', "Specifies the product icon theme used.")),
|
|
117
|
+
enum: [ThemeSettingDefaults.PRODUCT_ICON_THEME],
|
|
118
|
+
enumItemLabels: [( nls.localize('defaultProductIconThemeLabel', 'Default'))],
|
|
119
|
+
enumDescriptions: [( nls.localize('defaultProductIconThemeDesc', 'Default'))],
|
|
120
|
+
errorMessage: ( nls.localize('productIconThemeError', "Product icon theme is unknown or not installed."))
|
|
121
|
+
};
|
|
122
|
+
const detectHCSchemeSettingSchema = {
|
|
123
|
+
type: 'boolean',
|
|
124
|
+
default: true,
|
|
125
|
+
markdownDescription: ( nls.localize(
|
|
126
|
+
{ key: 'autoDetectHighContrast', comment: ['{0} and {1} will become links to other settings.'] },
|
|
127
|
+
"If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme. The high contrast theme to use is specified by {0} and {1}",
|
|
128
|
+
formatSettingAsLink(ThemeSettings.PREFERRED_HC_DARK_THEME),
|
|
129
|
+
formatSettingAsLink(ThemeSettings.PREFERRED_HC_LIGHT_THEME)
|
|
130
|
+
)),
|
|
131
|
+
scope: 1
|
|
132
|
+
};
|
|
133
|
+
const themeSettingsConfiguration = {
|
|
134
|
+
id: 'workbench',
|
|
135
|
+
order: 7.1,
|
|
136
|
+
type: 'object',
|
|
137
|
+
properties: {
|
|
138
|
+
[ThemeSettings.COLOR_THEME]: colorThemeSettingSchema,
|
|
139
|
+
[ThemeSettings.PREFERRED_DARK_THEME]: preferredDarkThemeSettingSchema,
|
|
140
|
+
[ThemeSettings.PREFERRED_LIGHT_THEME]: preferredLightThemeSettingSchema,
|
|
141
|
+
[ThemeSettings.PREFERRED_HC_DARK_THEME]: preferredHCDarkThemeSettingSchema,
|
|
142
|
+
[ThemeSettings.PREFERRED_HC_LIGHT_THEME]: preferredHCLightThemeSettingSchema,
|
|
143
|
+
[ThemeSettings.FILE_ICON_THEME]: fileIconThemeSettingSchema,
|
|
144
|
+
[ThemeSettings.COLOR_CUSTOMIZATIONS]: colorCustomizationsSchema,
|
|
145
|
+
[ThemeSettings.PRODUCT_ICON_THEME]: productIconThemeSettingSchema
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
configurationRegistry.registerConfiguration(themeSettingsConfiguration);
|
|
149
|
+
const themeSettingsWindowConfiguration = {
|
|
150
|
+
id: 'window',
|
|
151
|
+
order: 8.1,
|
|
152
|
+
type: 'object',
|
|
153
|
+
properties: {
|
|
154
|
+
[ThemeSettings.DETECT_HC]: detectHCSchemeSettingSchema,
|
|
155
|
+
[ThemeSettings.DETECT_COLOR_SCHEME]: detectColorSchemeSettingSchema,
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
configurationRegistry.registerConfiguration(themeSettingsWindowConfiguration);
|
|
159
|
+
function tokenGroupSettings(description) {
|
|
160
|
+
return {
|
|
161
|
+
description,
|
|
162
|
+
$ref: textmateColorGroupSchemaId
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const themeSpecificSettingKey = '^\\[[^\\]]*(\\]\\s*\\[[^\\]]*)*\\]$';
|
|
166
|
+
const tokenColorSchema = {
|
|
167
|
+
type: 'object',
|
|
168
|
+
properties: {
|
|
169
|
+
comments: tokenGroupSettings(( nls.localize('editorColors.comments', "Sets the colors and styles for comments"))),
|
|
170
|
+
strings: tokenGroupSettings(( nls.localize('editorColors.strings', "Sets the colors and styles for strings literals."))),
|
|
171
|
+
keywords: tokenGroupSettings(( nls.localize('editorColors.keywords', "Sets the colors and styles for keywords."))),
|
|
172
|
+
numbers: tokenGroupSettings(( nls.localize('editorColors.numbers', "Sets the colors and styles for number literals."))),
|
|
173
|
+
types: tokenGroupSettings(( nls.localize(
|
|
174
|
+
'editorColors.types',
|
|
175
|
+
"Sets the colors and styles for type declarations and references."
|
|
176
|
+
))),
|
|
177
|
+
functions: tokenGroupSettings(( nls.localize(
|
|
178
|
+
'editorColors.functions',
|
|
179
|
+
"Sets the colors and styles for functions declarations and references."
|
|
180
|
+
))),
|
|
181
|
+
variables: tokenGroupSettings(( nls.localize(
|
|
182
|
+
'editorColors.variables',
|
|
183
|
+
"Sets the colors and styles for variables declarations and references."
|
|
184
|
+
))),
|
|
185
|
+
textMateRules: {
|
|
186
|
+
description: ( nls.localize(
|
|
187
|
+
'editorColors.textMateRules',
|
|
188
|
+
'Sets colors and styles using textmate theming rules (advanced).'
|
|
189
|
+
)),
|
|
190
|
+
$ref: textmateColorsSchemaId
|
|
191
|
+
},
|
|
192
|
+
semanticHighlighting: {
|
|
193
|
+
description: ( nls.localize(
|
|
194
|
+
'editorColors.semanticHighlighting',
|
|
195
|
+
'Whether semantic highlighting should be enabled for this theme.'
|
|
196
|
+
)),
|
|
197
|
+
deprecationMessage: ( nls.localize(
|
|
198
|
+
'editorColors.semanticHighlighting.deprecationMessage',
|
|
199
|
+
'Use `enabled` in `editor.semanticTokenColorCustomizations` setting instead.'
|
|
200
|
+
)),
|
|
201
|
+
markdownDeprecationMessage: ( nls.localize(
|
|
202
|
+
{ key: 'editorColors.semanticHighlighting.deprecationMessageMarkdown', comment: ['{0} will become a link to another setting.'] },
|
|
203
|
+
'Use `enabled` in {0} setting instead.',
|
|
204
|
+
formatSettingAsLink('editor.semanticTokenColorCustomizations')
|
|
205
|
+
)),
|
|
206
|
+
type: 'boolean'
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
additionalProperties: false
|
|
210
|
+
};
|
|
211
|
+
const tokenColorCustomizationSchema = {
|
|
212
|
+
description: ( nls.localize(
|
|
213
|
+
'editorColors',
|
|
214
|
+
"Overrides editor syntax colors and font style from the currently selected color theme."
|
|
215
|
+
)),
|
|
216
|
+
default: {},
|
|
217
|
+
allOf: [{ ...tokenColorSchema, patternProperties: { '^\\[': {} } }]
|
|
218
|
+
};
|
|
219
|
+
const semanticTokenColorSchema = {
|
|
220
|
+
type: 'object',
|
|
221
|
+
properties: {
|
|
222
|
+
enabled: {
|
|
223
|
+
type: 'boolean',
|
|
224
|
+
description: ( nls.localize(
|
|
225
|
+
'editorColors.semanticHighlighting.enabled',
|
|
226
|
+
'Whether semantic highlighting is enabled or disabled for this theme'
|
|
227
|
+
)),
|
|
228
|
+
suggestSortText: '0_enabled'
|
|
229
|
+
},
|
|
230
|
+
rules: {
|
|
231
|
+
$ref: tokenStylingSchemaId,
|
|
232
|
+
description: ( nls.localize(
|
|
233
|
+
'editorColors.semanticHighlighting.rules',
|
|
234
|
+
'Semantic token styling rules for this theme.'
|
|
235
|
+
)),
|
|
236
|
+
suggestSortText: '0_rules'
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
additionalProperties: false
|
|
240
|
+
};
|
|
241
|
+
const semanticTokenColorCustomizationSchema = {
|
|
242
|
+
description: ( nls.localize(
|
|
243
|
+
'semanticTokenColors',
|
|
244
|
+
"Overrides editor semantic token color and styles from the currently selected color theme."
|
|
245
|
+
)),
|
|
246
|
+
default: {},
|
|
247
|
+
allOf: [{ ...semanticTokenColorSchema, patternProperties: { '^\\[': {} } }]
|
|
248
|
+
};
|
|
249
|
+
const tokenColorCustomizationConfiguration = {
|
|
250
|
+
id: 'editor',
|
|
251
|
+
order: 7.2,
|
|
252
|
+
type: 'object',
|
|
253
|
+
properties: {
|
|
254
|
+
[ThemeSettings.TOKEN_COLOR_CUSTOMIZATIONS]: tokenColorCustomizationSchema,
|
|
255
|
+
[ThemeSettings.SEMANTIC_TOKEN_COLOR_CUSTOMIZATIONS]: semanticTokenColorCustomizationSchema
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
configurationRegistry.registerConfiguration(tokenColorCustomizationConfiguration);
|
|
259
|
+
function updateColorThemeConfigurationSchemas(themes) {
|
|
260
|
+
themes.sort((a, b) => a.label.localeCompare(b.label));
|
|
261
|
+
colorThemeSettingEnum.splice(0, colorThemeSettingEnum.length, ...( themes.map(t => t.settingsId)));
|
|
262
|
+
colorThemeSettingEnumDescriptions.splice(0, colorThemeSettingEnumDescriptions.length, ...( themes.map(t => t.description || '')));
|
|
263
|
+
colorThemeSettingEnumItemLabels.splice(0, colorThemeSettingEnumItemLabels.length, ...( themes.map(t => t.label || '')));
|
|
264
|
+
const themeSpecificWorkbenchColors = { properties: {} };
|
|
265
|
+
const themeSpecificTokenColors = { properties: {} };
|
|
266
|
+
const themeSpecificSemanticTokenColors = { properties: {} };
|
|
267
|
+
const workbenchColors = { $ref: workbenchColorsSchemaId, additionalProperties: false };
|
|
268
|
+
const tokenColors = { properties: tokenColorSchema.properties, additionalProperties: false };
|
|
269
|
+
for (const t of themes) {
|
|
270
|
+
const themeId = `[${t.settingsId}]`;
|
|
271
|
+
themeSpecificWorkbenchColors.properties[themeId] = workbenchColors;
|
|
272
|
+
themeSpecificTokenColors.properties[themeId] = tokenColors;
|
|
273
|
+
themeSpecificSemanticTokenColors.properties[themeId] = semanticTokenColorSchema;
|
|
274
|
+
}
|
|
275
|
+
themeSpecificWorkbenchColors.patternProperties = { [themeSpecificSettingKey]: workbenchColors };
|
|
276
|
+
themeSpecificTokenColors.patternProperties = { [themeSpecificSettingKey]: tokenColors };
|
|
277
|
+
themeSpecificSemanticTokenColors.patternProperties = { [themeSpecificSettingKey]: semanticTokenColorSchema };
|
|
278
|
+
colorCustomizationsSchema.allOf[1] = themeSpecificWorkbenchColors;
|
|
279
|
+
tokenColorCustomizationSchema.allOf[1] = themeSpecificTokenColors;
|
|
280
|
+
semanticTokenColorCustomizationSchema.allOf[1] = themeSpecificSemanticTokenColors;
|
|
281
|
+
configurationRegistry.notifyConfigurationSchemaUpdated(themeSettingsConfiguration, tokenColorCustomizationConfiguration);
|
|
282
|
+
}
|
|
283
|
+
function updateFileIconThemeConfigurationSchemas(themes) {
|
|
284
|
+
fileIconThemeSettingSchema.enum.splice(1, Number.MAX_VALUE, ...( themes.map(t => t.settingsId)));
|
|
285
|
+
fileIconThemeSettingSchema.enumItemLabels.splice(1, Number.MAX_VALUE, ...( themes.map(t => t.label)));
|
|
286
|
+
fileIconThemeSettingSchema.enumDescriptions.splice(1, Number.MAX_VALUE, ...( themes.map(t => t.description || '')));
|
|
287
|
+
configurationRegistry.notifyConfigurationSchemaUpdated(themeSettingsConfiguration);
|
|
288
|
+
}
|
|
289
|
+
function updateProductIconThemeConfigurationSchemas(themes) {
|
|
290
|
+
productIconThemeSettingSchema.enum.splice(1, Number.MAX_VALUE, ...( themes.map(t => t.settingsId)));
|
|
291
|
+
productIconThemeSettingSchema.enumItemLabels.splice(1, Number.MAX_VALUE, ...( themes.map(t => t.label)));
|
|
292
|
+
productIconThemeSettingSchema.enumDescriptions.splice(1, Number.MAX_VALUE, ...( themes.map(t => t.description || '')));
|
|
293
|
+
configurationRegistry.notifyConfigurationSchemaUpdated(themeSettingsConfiguration);
|
|
294
|
+
}
|
|
295
|
+
class ThemeConfiguration {
|
|
296
|
+
constructor(configurationService) {
|
|
297
|
+
this.configurationService = configurationService;
|
|
298
|
+
}
|
|
299
|
+
get colorTheme() {
|
|
300
|
+
return this.configurationService.getValue(ThemeSettings.COLOR_THEME);
|
|
301
|
+
}
|
|
302
|
+
get fileIconTheme() {
|
|
303
|
+
return this.configurationService.getValue(ThemeSettings.FILE_ICON_THEME);
|
|
304
|
+
}
|
|
305
|
+
get productIconTheme() {
|
|
306
|
+
return this.configurationService.getValue(ThemeSettings.PRODUCT_ICON_THEME);
|
|
307
|
+
}
|
|
308
|
+
get colorCustomizations() {
|
|
309
|
+
return this.configurationService.getValue(ThemeSettings.COLOR_CUSTOMIZATIONS) || {};
|
|
310
|
+
}
|
|
311
|
+
get tokenColorCustomizations() {
|
|
312
|
+
return this.configurationService.getValue(ThemeSettings.TOKEN_COLOR_CUSTOMIZATIONS) || {};
|
|
313
|
+
}
|
|
314
|
+
get semanticTokenColorCustomizations() {
|
|
315
|
+
return this.configurationService.getValue(ThemeSettings.SEMANTIC_TOKEN_COLOR_CUSTOMIZATIONS);
|
|
316
|
+
}
|
|
317
|
+
async setColorTheme(theme, settingsTarget) {
|
|
318
|
+
await this.writeConfiguration(ThemeSettings.COLOR_THEME, theme.settingsId, settingsTarget);
|
|
319
|
+
return theme;
|
|
320
|
+
}
|
|
321
|
+
async setFileIconTheme(theme, settingsTarget) {
|
|
322
|
+
await this.writeConfiguration(ThemeSettings.FILE_ICON_THEME, theme.settingsId, settingsTarget);
|
|
323
|
+
return theme;
|
|
324
|
+
}
|
|
325
|
+
async setProductIconTheme(theme, settingsTarget) {
|
|
326
|
+
await this.writeConfiguration(ThemeSettings.PRODUCT_ICON_THEME, theme.settingsId, settingsTarget);
|
|
327
|
+
return theme;
|
|
328
|
+
}
|
|
329
|
+
isDefaultColorTheme() {
|
|
330
|
+
const settings = this.configurationService.inspect(ThemeSettings.COLOR_THEME);
|
|
331
|
+
return settings && settings.default?.value === settings.value;
|
|
332
|
+
}
|
|
333
|
+
findAutoConfigurationTarget(key) {
|
|
334
|
+
const settings = this.configurationService.inspect(key);
|
|
335
|
+
if (!types.isUndefined(settings.workspaceFolderValue)) {
|
|
336
|
+
return 6 ;
|
|
337
|
+
}
|
|
338
|
+
else if (!types.isUndefined(settings.workspaceValue)) {
|
|
339
|
+
return 5 ;
|
|
340
|
+
}
|
|
341
|
+
else if (!types.isUndefined(settings.userRemote)) {
|
|
342
|
+
return 4 ;
|
|
343
|
+
}
|
|
344
|
+
return 2 ;
|
|
345
|
+
}
|
|
346
|
+
async writeConfiguration(key, value, settingsTarget) {
|
|
347
|
+
if (settingsTarget === undefined || settingsTarget === 'preview') {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const settings = this.configurationService.inspect(key);
|
|
351
|
+
if (settingsTarget === 'auto') {
|
|
352
|
+
return this.configurationService.updateValue(key, value);
|
|
353
|
+
}
|
|
354
|
+
if (settingsTarget === 2 ) {
|
|
355
|
+
if (value === settings.userValue) {
|
|
356
|
+
return Promise.resolve(undefined);
|
|
357
|
+
}
|
|
358
|
+
else if (value === settings.defaultValue) {
|
|
359
|
+
if (types.isUndefined(settings.userValue)) {
|
|
360
|
+
return Promise.resolve(undefined);
|
|
361
|
+
}
|
|
362
|
+
value = undefined;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
else if (settingsTarget === 5 || settingsTarget === 6 || settingsTarget === 4 ) {
|
|
366
|
+
if (value === settings.value) {
|
|
367
|
+
return Promise.resolve(undefined);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return this.configurationService.updateValue(key, value, settingsTarget);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export { ThemeConfiguration, updateColorThemeConfigurationSchemas, updateFileIconThemeConfigurationSchemas, updateProductIconThemeConfigurationSchemas };
|