@codingame/monaco-vscode-theme-service-override 10.1.4 → 11.0.0
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/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/themes/browser/themes.contribution.js +49 -49
- package/vscode/src/vs/workbench/services/themes/browser/fileIconThemeData.js +20 -6
- package/vscode/src/vs/workbench/services/themes/browser/productIconThemeData.js +12 -12
- package/vscode/src/vs/workbench/services/themes/browser/workbenchThemeService.js +1 -1
- package/vscode/src/vs/workbench/services/themes/common/colorThemeSchema.js +13 -13
- package/vscode/src/vs/workbench/services/themes/common/fileIconThemeSchema.js +40 -40
- package/vscode/src/vs/workbench/services/themes/common/productIconThemeSchema.js +8 -8
- package/vscode/src/vs/workbench/services/themes/common/themeConfiguration.js +36 -36
- package/vscode/src/vs/workbench/services/themes/common/themeExtensionPoints.js +21 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-theme-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
30
|
-
"@codingame/monaco-vscode-files-service-override": "
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@11.0.0",
|
|
30
|
+
"@codingame/monaco-vscode-files-service-override": "11.0.0"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -57,7 +57,7 @@ import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
|
57
57
|
import Severity$1 from 'vscode/vscode/vs/base/common/severity';
|
|
58
58
|
|
|
59
59
|
var DefaultThemeUpdatedNotificationContribution_1;
|
|
60
|
-
const manageExtensionIcon = registerIcon('theme-selection-manage-extension', Codicon.gear, ( localize(
|
|
60
|
+
const manageExtensionIcon = registerIcon('theme-selection-manage-extension', Codicon.gear, ( localize(2539, 'Icon for the \'Manage\' action in the theme selection quick pick.')));
|
|
61
61
|
var ConfigureItem;
|
|
62
62
|
( ((function(ConfigureItem) {
|
|
63
63
|
ConfigureItem["BROWSE_GALLERY"] = "marketplace";
|
|
@@ -165,7 +165,7 @@ let MarketplaceThemesPicker = class MarketplaceThemesPicker {
|
|
|
165
165
|
quickpick.matchOnDescription = true;
|
|
166
166
|
quickpick.buttons = [this.quickInputService.backButton];
|
|
167
167
|
quickpick.title = 'Marketplace Themes';
|
|
168
|
-
quickpick.placeholder = ( localize(
|
|
168
|
+
quickpick.placeholder = ( localize(2540, "Type to Search More. Select to Install. Up/Down Keys to Preview"));
|
|
169
169
|
quickpick.canSelectMany = false;
|
|
170
170
|
disposables.add(quickpick.onDidChangeValue(() => this.trigger(quickpick.value)));
|
|
171
171
|
disposables.add(quickpick.onDidAccept(async (_) => {
|
|
@@ -214,10 +214,10 @@ let MarketplaceThemesPicker = class MarketplaceThemesPicker {
|
|
|
214
214
|
disposables.add(this.onDidChange(() => {
|
|
215
215
|
let items = this.themes;
|
|
216
216
|
if (this._searchOngoing) {
|
|
217
|
-
items = items.concat({ label: '$(
|
|
217
|
+
items = items.concat({ label: '$(loading~spin) Searching for themes...', id: undefined, alwaysShow: true });
|
|
218
218
|
}
|
|
219
219
|
else if (items.length === 0 && this._searchError) {
|
|
220
|
-
items = [{ label: `$(error) ${( localize(
|
|
220
|
+
items = [{ label: `$(error) ${( localize(2541, 'Error while searching for themes: {0}', this._searchError))}`, id: undefined, alwaysShow: true }];
|
|
221
221
|
}
|
|
222
222
|
const activeItemId = quickpick.activeItems[0]?.id;
|
|
223
223
|
const newActiveItem = activeItemId ? items.find(i => isItem(i) && i.id === activeItemId) : undefined;
|
|
@@ -236,12 +236,12 @@ let MarketplaceThemesPicker = class MarketplaceThemesPicker {
|
|
|
236
236
|
this.extensionsWorkbenchService.openSearch(`@id:${galleryExtension.identifier.id}`);
|
|
237
237
|
const result = await this.dialogService.confirm({
|
|
238
238
|
message: ( localize(
|
|
239
|
-
|
|
239
|
+
2542,
|
|
240
240
|
"This will install extension '{0}' published by '{1}'. Do you want to continue?",
|
|
241
241
|
galleryExtension.displayName,
|
|
242
242
|
galleryExtension.publisherDisplayName
|
|
243
243
|
)),
|
|
244
|
-
primaryButton: ( localize(
|
|
244
|
+
primaryButton: ( localize(2543, "OK"))
|
|
245
245
|
});
|
|
246
246
|
if (!result.confirmed) {
|
|
247
247
|
return false;
|
|
@@ -249,7 +249,7 @@ let MarketplaceThemesPicker = class MarketplaceThemesPicker {
|
|
|
249
249
|
try {
|
|
250
250
|
await this.progressService.withProgress({
|
|
251
251
|
location: 15 ,
|
|
252
|
-
title: ( localize(
|
|
252
|
+
title: ( localize(2544, "Installing Extension {0}...", galleryExtension.displayName))
|
|
253
253
|
}, async () => {
|
|
254
254
|
await this.extensionManagementService.installFromGallery(galleryExtension, {
|
|
255
255
|
isMachineScoped: false,
|
|
@@ -396,7 +396,7 @@ registerAction2(class extends Action2 {
|
|
|
396
396
|
constructor() {
|
|
397
397
|
super({
|
|
398
398
|
id: SelectColorThemeCommandId,
|
|
399
|
-
title: ( localize2(
|
|
399
|
+
title: ( localize2(2545, 'Color Theme')),
|
|
400
400
|
category: Categories.Preferences,
|
|
401
401
|
f1: true,
|
|
402
402
|
keybinding: {
|
|
@@ -407,12 +407,12 @@ registerAction2(class extends Action2 {
|
|
|
407
407
|
}
|
|
408
408
|
getTitle(colorScheme) {
|
|
409
409
|
switch (colorScheme) {
|
|
410
|
-
case ColorScheme.DARK: return ( localize(
|
|
411
|
-
case ColorScheme.LIGHT: return ( localize(
|
|
412
|
-
case ColorScheme.HIGH_CONTRAST_DARK: return ( localize(
|
|
413
|
-
case ColorScheme.HIGH_CONTRAST_LIGHT: return ( localize(
|
|
410
|
+
case ColorScheme.DARK: return ( localize(2546, "Select Color Theme for System Dark Mode"));
|
|
411
|
+
case ColorScheme.LIGHT: return ( localize(2547, "Select Color Theme for System Light Mode"));
|
|
412
|
+
case ColorScheme.HIGH_CONTRAST_DARK: return ( localize(2548, "Select Color Theme for High Contrast Dark Mode"));
|
|
413
|
+
case ColorScheme.HIGH_CONTRAST_LIGHT: return ( localize(2549, "Select Color Theme for High Contrast Light Mode"));
|
|
414
414
|
default:
|
|
415
|
-
return ( localize(
|
|
415
|
+
return ( localize(2550, "Select Color Theme (detect system color mode disabled)"));
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
async run(accessor) {
|
|
@@ -422,7 +422,7 @@ registerAction2(class extends Action2 {
|
|
|
422
422
|
let modeConfigureToggle;
|
|
423
423
|
if (preferredColorScheme) {
|
|
424
424
|
modeConfigureToggle = ( (new Toggle({
|
|
425
|
-
title: ( localize(
|
|
425
|
+
title: ( localize(2551, 'Detect system color mode enabled. Click to configure.')),
|
|
426
426
|
icon: Codicon.colorMode,
|
|
427
427
|
isChecked: false,
|
|
428
428
|
...defaultToggleStyles
|
|
@@ -430,15 +430,15 @@ registerAction2(class extends Action2 {
|
|
|
430
430
|
}
|
|
431
431
|
else {
|
|
432
432
|
modeConfigureToggle = ( (new Toggle({
|
|
433
|
-
title: ( localize(
|
|
433
|
+
title: ( localize(2552, 'Detect system color mode disabled. Click to configure.')),
|
|
434
434
|
icon: Codicon.colorMode,
|
|
435
435
|
isChecked: false,
|
|
436
436
|
...defaultToggleStyles
|
|
437
437
|
})));
|
|
438
438
|
}
|
|
439
439
|
const options = {
|
|
440
|
-
installMessage: ( localize(
|
|
441
|
-
browseMessage: '$(plus) ' + ( localize(
|
|
440
|
+
installMessage: ( localize(2553, "Install Additional Color Themes...")),
|
|
441
|
+
browseMessage: '$(plus) ' + ( localize(2554, "Browse Additional Color Themes...")),
|
|
442
442
|
placeholderMessage: this.getTitle(preferredColorScheme),
|
|
443
443
|
marketplaceTag: 'category:themes',
|
|
444
444
|
toggles: [modeConfigureToggle],
|
|
@@ -453,9 +453,9 @@ registerAction2(class extends Action2 {
|
|
|
453
453
|
const picker = instantiationService.createInstance(InstalledThemesPicker, options, setTheme, getMarketplaceColorThemes);
|
|
454
454
|
const themes = await themeService.getColorThemes();
|
|
455
455
|
const currentTheme = themeService.getColorTheme();
|
|
456
|
-
const lightEntries = toEntries(themes.filter(t => t.type === ColorScheme.LIGHT), ( localize(
|
|
457
|
-
const darkEntries = toEntries(themes.filter(t => t.type === ColorScheme.DARK), ( localize(
|
|
458
|
-
const hcEntries = toEntries(themes.filter(t => isHighContrast(t.type)), ( localize(
|
|
456
|
+
const lightEntries = toEntries(themes.filter(t => t.type === ColorScheme.LIGHT), ( localize(2555, "light themes")));
|
|
457
|
+
const darkEntries = toEntries(themes.filter(t => t.type === ColorScheme.DARK), ( localize(2556, "dark themes")));
|
|
458
|
+
const hcEntries = toEntries(themes.filter(t => isHighContrast(t.type)), ( localize(2557, "high contrast themes")));
|
|
459
459
|
let picks;
|
|
460
460
|
switch (preferredColorScheme) {
|
|
461
461
|
case ColorScheme.DARK:
|
|
@@ -478,7 +478,7 @@ registerAction2(class extends Action2 {
|
|
|
478
478
|
constructor() {
|
|
479
479
|
super({
|
|
480
480
|
id: SelectFileIconThemeCommandId,
|
|
481
|
-
title: ( localize2(
|
|
481
|
+
title: ( localize2(2558, 'File Icon Theme')),
|
|
482
482
|
category: Categories.Preferences,
|
|
483
483
|
f1: true
|
|
484
484
|
});
|
|
@@ -486,8 +486,8 @@ registerAction2(class extends Action2 {
|
|
|
486
486
|
async run(accessor) {
|
|
487
487
|
const themeService = accessor.get(IWorkbenchThemeService);
|
|
488
488
|
const options = {
|
|
489
|
-
installMessage: ( localize(
|
|
490
|
-
placeholderMessage: ( localize(
|
|
489
|
+
installMessage: ( localize(2559, "Install Additional File Icon Themes...")),
|
|
490
|
+
placeholderMessage: ( localize(2560, "Select File Icon Theme (Up/Down Keys to Preview)")),
|
|
491
491
|
marketplaceTag: 'tag:icon-theme'
|
|
492
492
|
};
|
|
493
493
|
const setTheme = (theme, settingsTarget) => themeService.setFileIconTheme(theme, settingsTarget);
|
|
@@ -495,8 +495,8 @@ registerAction2(class extends Action2 {
|
|
|
495
495
|
const instantiationService = accessor.get(IInstantiationService);
|
|
496
496
|
const picker = instantiationService.createInstance(InstalledThemesPicker, options, setTheme, getMarketplaceColorThemes);
|
|
497
497
|
const picks = [
|
|
498
|
-
{ type: 'separator', label: ( localize(
|
|
499
|
-
{ id: '', theme: FileIconThemeData.noIconTheme, label: ( localize(
|
|
498
|
+
{ type: 'separator', label: ( localize(2561, 'file icon themes')) },
|
|
499
|
+
{ id: '', theme: FileIconThemeData.noIconTheme, label: ( localize(2562, 'None')), description: ( localize(2563, 'Disable File Icons')) },
|
|
500
500
|
...toEntries(await themeService.getFileIconThemes()),
|
|
501
501
|
];
|
|
502
502
|
await picker.openQuickPick(picks, themeService.getFileIconTheme());
|
|
@@ -507,7 +507,7 @@ registerAction2(class extends Action2 {
|
|
|
507
507
|
constructor() {
|
|
508
508
|
super({
|
|
509
509
|
id: SelectProductIconThemeCommandId,
|
|
510
|
-
title: ( localize2(
|
|
510
|
+
title: ( localize2(2564, 'Product Icon Theme')),
|
|
511
511
|
category: Categories.Preferences,
|
|
512
512
|
f1: true
|
|
513
513
|
});
|
|
@@ -515,9 +515,9 @@ registerAction2(class extends Action2 {
|
|
|
515
515
|
async run(accessor) {
|
|
516
516
|
const themeService = accessor.get(IWorkbenchThemeService);
|
|
517
517
|
const options = {
|
|
518
|
-
installMessage: ( localize(
|
|
519
|
-
browseMessage: '$(plus) ' + ( localize(
|
|
520
|
-
placeholderMessage: ( localize(
|
|
518
|
+
installMessage: ( localize(2565, "Install Additional Product Icon Themes...")),
|
|
519
|
+
browseMessage: '$(plus) ' + ( localize(2566, "Browse Additional Product Icon Themes...")),
|
|
520
|
+
placeholderMessage: ( localize(2567, "Select Product Icon Theme (Up/Down Keys to Preview)")),
|
|
521
521
|
marketplaceTag: 'tag:product-icon-theme'
|
|
522
522
|
};
|
|
523
523
|
const setTheme = (theme, settingsTarget) => themeService.setProductIconTheme(theme, settingsTarget);
|
|
@@ -525,8 +525,8 @@ registerAction2(class extends Action2 {
|
|
|
525
525
|
const instantiationService = accessor.get(IInstantiationService);
|
|
526
526
|
const picker = instantiationService.createInstance(InstalledThemesPicker, options, setTheme, getMarketplaceColorThemes);
|
|
527
527
|
const picks = [
|
|
528
|
-
{ type: 'separator', label: ( localize(
|
|
529
|
-
{ id: DEFAULT_PRODUCT_ICON_THEME_ID, theme: ProductIconThemeData.defaultTheme, label: ( localize(
|
|
528
|
+
{ type: 'separator', label: ( localize(2568, 'product icon themes')) },
|
|
529
|
+
{ id: DEFAULT_PRODUCT_ICON_THEME_ID, theme: ProductIconThemeData.defaultTheme, label: ( localize(2569, 'Default')) },
|
|
530
530
|
...toEntries(await themeService.getProductIconThemes()),
|
|
531
531
|
];
|
|
532
532
|
await picker.openQuickPick(picks, themeService.getProductIconTheme());
|
|
@@ -584,13 +584,13 @@ function toEntries(themes, label) {
|
|
|
584
584
|
}
|
|
585
585
|
const configureButton = {
|
|
586
586
|
iconClass: ThemeIcon.asClassName(manageExtensionIcon),
|
|
587
|
-
tooltip: ( localize(
|
|
587
|
+
tooltip: ( localize(2570, "Manage Extension")),
|
|
588
588
|
};
|
|
589
589
|
registerAction2(class extends Action2 {
|
|
590
590
|
constructor() {
|
|
591
591
|
super({
|
|
592
592
|
id: 'workbench.action.generateColorTheme',
|
|
593
|
-
title: ( localize2(
|
|
593
|
+
title: ( localize2(2571, 'Generate Color Theme From Current Settings')),
|
|
594
594
|
category: Categories.Developer,
|
|
595
595
|
f1: true
|
|
596
596
|
});
|
|
@@ -640,7 +640,7 @@ registerAction2(class extends Action2 {
|
|
|
640
640
|
constructor() {
|
|
641
641
|
super({
|
|
642
642
|
id: toggleLightDarkThemesCommandId,
|
|
643
|
-
title: ( localize2(
|
|
643
|
+
title: ( localize2(2572, 'Toggle between Light/Dark Themes')),
|
|
644
644
|
category: Categories.Preferences,
|
|
645
645
|
f1: true,
|
|
646
646
|
});
|
|
@@ -652,13 +652,13 @@ registerAction2(class extends Action2 {
|
|
|
652
652
|
const preferencesService = accessor.get(IPreferencesService);
|
|
653
653
|
if (configurationService.getValue(ThemeSettings.DETECT_COLOR_SCHEME)) {
|
|
654
654
|
const message = ( localize(
|
|
655
|
-
|
|
655
|
+
2573,
|
|
656
656
|
"Cannot toggle between light and dark themes when `{0}` is enabled in settings.",
|
|
657
657
|
ThemeSettings.DETECT_COLOR_SCHEME
|
|
658
658
|
));
|
|
659
659
|
notificationService.prompt(Severity$1.Info, message, [
|
|
660
660
|
{
|
|
661
|
-
label: ( localize(
|
|
661
|
+
label: ( localize(2574, "Open Settings")),
|
|
662
662
|
run: () => {
|
|
663
663
|
return preferencesService.openUserSettings({ query: ThemeSettings.DETECT_COLOR_SCHEME });
|
|
664
664
|
}
|
|
@@ -696,7 +696,7 @@ registerAction2(class extends Action2 {
|
|
|
696
696
|
constructor() {
|
|
697
697
|
super({
|
|
698
698
|
id: browseColorThemesInMarketplaceCommandId,
|
|
699
|
-
title: ( localize2(
|
|
699
|
+
title: ( localize2(2575, 'Browse Color Themes in Marketplace')),
|
|
700
700
|
category: Categories.Preferences,
|
|
701
701
|
f1: true,
|
|
702
702
|
});
|
|
@@ -732,13 +732,13 @@ registerAction2(class extends Action2 {
|
|
|
732
732
|
});
|
|
733
733
|
const ThemesSubMenu = ( (new MenuId('ThemesSubMenu')));
|
|
734
734
|
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
735
|
-
title: ( localize(
|
|
735
|
+
title: ( localize(2576, "Themes")),
|
|
736
736
|
submenu: ThemesSubMenu,
|
|
737
737
|
group: '2_configuration',
|
|
738
738
|
order: 7
|
|
739
739
|
});
|
|
740
740
|
MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
|
|
741
|
-
title: ( localize(
|
|
741
|
+
title: ( localize(2577, "&&Theme")),
|
|
742
742
|
submenu: ThemesSubMenu,
|
|
743
743
|
group: '2_configuration',
|
|
744
744
|
order: 7
|
|
@@ -746,21 +746,21 @@ MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
|
|
|
746
746
|
MenuRegistry.appendMenuItem(ThemesSubMenu, {
|
|
747
747
|
command: {
|
|
748
748
|
id: SelectColorThemeCommandId,
|
|
749
|
-
title: ( localize(
|
|
749
|
+
title: ( localize(2545, 'Color Theme'))
|
|
750
750
|
},
|
|
751
751
|
order: 1
|
|
752
752
|
});
|
|
753
753
|
MenuRegistry.appendMenuItem(ThemesSubMenu, {
|
|
754
754
|
command: {
|
|
755
755
|
id: SelectFileIconThemeCommandId,
|
|
756
|
-
title: ( localize(
|
|
756
|
+
title: ( localize(2578, "File Icon Theme"))
|
|
757
757
|
},
|
|
758
758
|
order: 2
|
|
759
759
|
});
|
|
760
760
|
MenuRegistry.appendMenuItem(ThemesSubMenu, {
|
|
761
761
|
command: {
|
|
762
762
|
id: SelectProductIconThemeCommandId,
|
|
763
|
-
title: ( localize(
|
|
763
|
+
title: ( localize(2579, "Product Icon Theme"))
|
|
764
764
|
},
|
|
765
765
|
order: 3
|
|
766
766
|
});
|
|
@@ -802,20 +802,20 @@ let DefaultThemeUpdatedNotificationContribution = class DefaultThemeUpdatedNotif
|
|
|
802
802
|
if (newTheme) {
|
|
803
803
|
const choices = [
|
|
804
804
|
{
|
|
805
|
-
label: ( localize(
|
|
805
|
+
label: ( localize(2580, "Keep New Theme")),
|
|
806
806
|
run: () => {
|
|
807
807
|
this._writeTelemetry('keepNew');
|
|
808
808
|
}
|
|
809
809
|
},
|
|
810
810
|
{
|
|
811
|
-
label: ( localize(
|
|
811
|
+
label: ( localize(2581, "Browse Themes")),
|
|
812
812
|
run: () => {
|
|
813
813
|
this._writeTelemetry('browse');
|
|
814
814
|
this._commandService.executeCommand(SelectColorThemeCommandId);
|
|
815
815
|
}
|
|
816
816
|
},
|
|
817
817
|
{
|
|
818
|
-
label: ( localize(
|
|
818
|
+
label: ( localize(2582, "Revert")),
|
|
819
819
|
run: async () => {
|
|
820
820
|
this._writeTelemetry('keepOld');
|
|
821
821
|
const oldSettingsId = usingLight ? ThemeSettingDefaults.COLOR_THEME_LIGHT_OLD : ThemeSettingDefaults.COLOR_THEME_DARK_OLD;
|
|
@@ -827,7 +827,7 @@ let DefaultThemeUpdatedNotificationContribution = class DefaultThemeUpdatedNotif
|
|
|
827
827
|
}
|
|
828
828
|
];
|
|
829
829
|
await this._notificationService.prompt(Severity$1.Info, ( localize(
|
|
830
|
-
|
|
830
|
+
2583,
|
|
831
831
|
"Visual Studio Code now ships with a new default theme '{0}'. If you prefer, you can switch back to the old theme or try one of the many other color themes available.",
|
|
832
832
|
newTheme.label
|
|
833
833
|
)), choices, {
|
|
@@ -840,20 +840,20 @@ let DefaultThemeUpdatedNotificationContribution = class DefaultThemeUpdatedNotif
|
|
|
840
840
|
const theme = (await this._workbenchThemeService.getColorThemes()).find(theme => theme.settingsId === newThemeSettingsId);
|
|
841
841
|
if (theme) {
|
|
842
842
|
const choices = [{
|
|
843
|
-
label: ( localize(
|
|
843
|
+
label: ( localize(2584, "Try New Theme")),
|
|
844
844
|
run: () => {
|
|
845
845
|
this._writeTelemetry('tryNew');
|
|
846
846
|
this._workbenchThemeService.setColorTheme(theme, 'auto');
|
|
847
847
|
}
|
|
848
848
|
},
|
|
849
849
|
{
|
|
850
|
-
label: ( localize(
|
|
850
|
+
label: ( localize(2585, "Cancel")),
|
|
851
851
|
run: () => {
|
|
852
852
|
this._writeTelemetry('cancel');
|
|
853
853
|
}
|
|
854
854
|
}];
|
|
855
855
|
await this._notificationService.prompt(Severity$1.Info, ( localize(
|
|
856
|
-
|
|
856
|
+
2586,
|
|
857
857
|
"Visual Studio Code now ships with a new default theme '{0}'. Do you want to give it a try?",
|
|
858
858
|
theme.label
|
|
859
859
|
)), choices, { onCancel: () => this._writeTelemetry('cancel') });
|
|
@@ -4,7 +4,7 @@ import { dirname, joinPath } from 'vscode/vscode/vs/base/common/resources';
|
|
|
4
4
|
import { parse, getNodeType } from 'vscode/vscode/vs/base/common/json';
|
|
5
5
|
import { ExtensionData } from 'vscode/vscode/vs/workbench/services/themes/common/workbenchThemeService';
|
|
6
6
|
import { getParseErrorMessage } from 'vscode/vscode/vs/base/common/jsonErrorMessages';
|
|
7
|
-
import { asCSSUrl } from 'vscode/vscode/vs/base/browser/
|
|
7
|
+
import { asCSSUrl } from 'vscode/vscode/vs/base/browser/cssValue';
|
|
8
8
|
import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
|
|
9
9
|
|
|
10
10
|
class FileIconThemeData {
|
|
@@ -138,13 +138,13 @@ class FileIconThemeLoader {
|
|
|
138
138
|
const contentValue = parse(content, errors);
|
|
139
139
|
if (errors.length > 0) {
|
|
140
140
|
return Promise.reject(( (new Error(( localize(
|
|
141
|
-
|
|
141
|
+
6768,
|
|
142
142
|
"Problems parsing file icons file: {0}",
|
|
143
143
|
( (errors.map(e => getParseErrorMessage(e.error)))).join(', ')
|
|
144
144
|
))))));
|
|
145
145
|
}
|
|
146
146
|
else if (getNodeType(contentValue) !== 'object') {
|
|
147
|
-
return Promise.reject(( (new Error(( localize(
|
|
147
|
+
return Promise.reject(( (new Error(( localize(6769, "Invalid format for file icons theme file: Object expected."))))));
|
|
148
148
|
}
|
|
149
149
|
return Promise.resolve(contentValue);
|
|
150
150
|
});
|
|
@@ -297,12 +297,13 @@ class FileIconThemeLoader {
|
|
|
297
297
|
const fonts = iconThemeDocument.fonts;
|
|
298
298
|
const fontSizes = ( (new Map()));
|
|
299
299
|
if (Array.isArray(fonts)) {
|
|
300
|
-
const defaultFontSize = fonts[0].size || '150%';
|
|
300
|
+
const defaultFontSize = this.tryNormalizeFontSize(fonts[0].size) || '150%';
|
|
301
301
|
fonts.forEach(font => {
|
|
302
302
|
const src = ( (font.src.map(l => `${asCSSUrl(resolvePath(l.path))} format('${l.format}')`))).join(', ');
|
|
303
303
|
cssRules.push(`@font-face { src: ${src}; font-family: '${font.id}'; font-weight: ${font.weight}; font-style: ${font.style}; font-display: block; }`);
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
const fontSize = this.tryNormalizeFontSize(font.size);
|
|
305
|
+
if (fontSize !== undefined && fontSize !== defaultFontSize) {
|
|
306
|
+
fontSizes.set(font.id, fontSize);
|
|
306
307
|
}
|
|
307
308
|
});
|
|
308
309
|
cssRules.push(`.show-file-icons .file-icon::before, .show-file-icons .folder-icon::before, .show-file-icons .rootfolder-icon::before { font-family: '${fonts[0].id}'; font-size: ${defaultFontSize}; }`);
|
|
@@ -352,6 +353,19 @@ class FileIconThemeLoader {
|
|
|
352
353
|
result.content = cssRules.join('\n');
|
|
353
354
|
return result;
|
|
354
355
|
}
|
|
356
|
+
tryNormalizeFontSize(size) {
|
|
357
|
+
if (!size) {
|
|
358
|
+
return undefined;
|
|
359
|
+
}
|
|
360
|
+
const defaultFontSizeInPx = 13;
|
|
361
|
+
if (size.endsWith('px')) {
|
|
362
|
+
const value = parseInt(size, 10);
|
|
363
|
+
if (!isNaN(value)) {
|
|
364
|
+
return Math.round((value / defaultFontSizeInPx) * 100) + '%';
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return size;
|
|
368
|
+
}
|
|
355
369
|
}
|
|
356
370
|
function handleParentFolder(key, selectors) {
|
|
357
371
|
const lastIndexOfSlash = key.lastIndexOf('/');
|
|
@@ -38,7 +38,7 @@ class ProductIconThemeData {
|
|
|
38
38
|
this.isLoaded = true;
|
|
39
39
|
if (warnings.length) {
|
|
40
40
|
logService.error(( localize(
|
|
41
|
-
|
|
41
|
+
6874,
|
|
42
42
|
"Problems processing product icons definitions in {0}:\n{1}",
|
|
43
43
|
(location.toString()),
|
|
44
44
|
warnings.join('\n')
|
|
@@ -69,7 +69,7 @@ class ProductIconThemeData {
|
|
|
69
69
|
static get defaultTheme() {
|
|
70
70
|
let themeData = ProductIconThemeData._defaultProductIconTheme;
|
|
71
71
|
if (!themeData) {
|
|
72
|
-
themeData = ProductIconThemeData._defaultProductIconTheme = ( (new ProductIconThemeData(DEFAULT_PRODUCT_ICON_THEME_ID, ( localize(
|
|
72
|
+
themeData = ProductIconThemeData._defaultProductIconTheme = ( (new ProductIconThemeData(DEFAULT_PRODUCT_ICON_THEME_ID, ( localize(6875, 'Default')), ThemeSettingDefaults.PRODUCT_ICON_THEME)));
|
|
73
73
|
themeData.isLoaded = true;
|
|
74
74
|
themeData.extensionData = undefined;
|
|
75
75
|
themeData.watch = false;
|
|
@@ -156,17 +156,17 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
156
156
|
const contentValue = parse(content, parseErrors);
|
|
157
157
|
if (parseErrors.length > 0) {
|
|
158
158
|
return Promise.reject(( (new Error(( localize(
|
|
159
|
-
|
|
159
|
+
6876,
|
|
160
160
|
"Problems parsing product icons file: {0}",
|
|
161
161
|
( (parseErrors.map(e => getParseErrorMessage(e.error)))).join(', ')
|
|
162
162
|
))))));
|
|
163
163
|
}
|
|
164
164
|
else if (getNodeType(contentValue) !== 'object') {
|
|
165
|
-
return Promise.reject(( (new Error(( localize(
|
|
165
|
+
return Promise.reject(( (new Error(( localize(6877, "Invalid format for product icons theme file: Object expected."))))));
|
|
166
166
|
}
|
|
167
167
|
else if (!contentValue.iconDefinitions || !Array.isArray(contentValue.fonts) || !contentValue.fonts.length) {
|
|
168
168
|
return Promise.reject(( (new Error(( localize(
|
|
169
|
-
|
|
169
|
+
6878,
|
|
170
170
|
"Invalid format for product icons theme file: Must contain iconDefinitions and fonts."
|
|
171
171
|
))))));
|
|
172
172
|
}
|
|
@@ -180,14 +180,14 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
180
180
|
fontWeight = font.weight;
|
|
181
181
|
}
|
|
182
182
|
else {
|
|
183
|
-
warnings.push(( localize(
|
|
183
|
+
warnings.push(( localize(6879, 'Invalid font weight in font \'{0}\'. Ignoring setting.', font.id)));
|
|
184
184
|
}
|
|
185
185
|
let fontStyle = undefined;
|
|
186
186
|
if (isString(font.style) && font.style.match(fontStyleRegex)) {
|
|
187
187
|
fontStyle = font.style;
|
|
188
188
|
}
|
|
189
189
|
else {
|
|
190
|
-
warnings.push(( localize(
|
|
190
|
+
warnings.push(( localize(6880, 'Invalid font style in font \'{0}\'. Ignoring setting.', font.id)));
|
|
191
191
|
}
|
|
192
192
|
const sanitizedSrc = [];
|
|
193
193
|
if (Array.isArray(font.src)) {
|
|
@@ -197,7 +197,7 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
197
197
|
sanitizedSrc.push({ location: iconFontLocation, format: s.format });
|
|
198
198
|
}
|
|
199
199
|
else {
|
|
200
|
-
warnings.push(( localize(
|
|
200
|
+
warnings.push(( localize(6881, 'Invalid font source in font \'{0}\'. Ignoring source.', font.id)));
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
}
|
|
@@ -206,7 +206,7 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
206
206
|
}
|
|
207
207
|
else {
|
|
208
208
|
warnings.push(( localize(
|
|
209
|
-
|
|
209
|
+
6882,
|
|
210
210
|
'No valid font source in font \'{0}\'. Ignoring font definition.',
|
|
211
211
|
font.id
|
|
212
212
|
)));
|
|
@@ -214,7 +214,7 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
214
214
|
}
|
|
215
215
|
else {
|
|
216
216
|
warnings.push(( localize(
|
|
217
|
-
|
|
217
|
+
6883,
|
|
218
218
|
'Missing or invalid font id \'{0}\'. Skipping font definition.',
|
|
219
219
|
font.id
|
|
220
220
|
)));
|
|
@@ -232,11 +232,11 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
232
232
|
iconDefinitions.set(iconId, { fontCharacter: definition.fontCharacter, font });
|
|
233
233
|
}
|
|
234
234
|
else {
|
|
235
|
-
warnings.push(( localize(
|
|
235
|
+
warnings.push(( localize(6884, 'Skipping icon definition \'{0}\'. Unknown font.', iconId)));
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
else {
|
|
239
|
-
warnings.push(( localize(
|
|
239
|
+
warnings.push(( localize(6885, 'Skipping icon definition \'{0}\'. Unknown fontCharacter.', iconId)));
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
return { iconDefinitions };
|
|
@@ -135,31 +135,31 @@ const textmateColorSchema = {
|
|
|
135
135
|
},
|
|
136
136
|
settings: {
|
|
137
137
|
type: 'object',
|
|
138
|
-
description: ( localize(
|
|
138
|
+
description: ( localize(6770, 'Colors and styles for the token.')),
|
|
139
139
|
properties: {
|
|
140
140
|
foreground: {
|
|
141
141
|
type: 'string',
|
|
142
|
-
description: ( localize(
|
|
142
|
+
description: ( localize(6771, 'Foreground color for the token.')),
|
|
143
143
|
format: 'color-hex',
|
|
144
144
|
default: '#ff0000'
|
|
145
145
|
},
|
|
146
146
|
background: {
|
|
147
147
|
type: 'string',
|
|
148
|
-
deprecationMessage: ( localize(
|
|
148
|
+
deprecationMessage: ( localize(6772, 'Token background colors are currently not supported.'))
|
|
149
149
|
},
|
|
150
150
|
fontStyle: {
|
|
151
151
|
type: 'string',
|
|
152
152
|
description: ( localize(
|
|
153
|
-
|
|
153
|
+
6773,
|
|
154
154
|
'Font style of the rule: \'italic\', \'bold\', \'underline\', \'strikethrough\' or a combination. The empty string unsets inherited settings.'
|
|
155
155
|
)),
|
|
156
156
|
pattern: '^(\\s*\\b(italic|bold|underline|strikethrough))*\\s*$',
|
|
157
157
|
patternErrorMessage: ( localize(
|
|
158
|
-
|
|
158
|
+
6774,
|
|
159
159
|
'Font style must be \'italic\', \'bold\', \'underline\', \'strikethrough\' or a combination or the empty string.'
|
|
160
160
|
)),
|
|
161
161
|
defaultSnippets: [
|
|
162
|
-
{ label: ( localize(
|
|
162
|
+
{ label: ( localize(6775, 'None (clear inherited style)')), bodyText: '""' },
|
|
163
163
|
{ body: 'italic' },
|
|
164
164
|
{ body: 'bold' },
|
|
165
165
|
{ body: 'underline' },
|
|
@@ -188,10 +188,10 @@ const textmateColorSchema = {
|
|
|
188
188
|
properties: {
|
|
189
189
|
name: {
|
|
190
190
|
type: 'string',
|
|
191
|
-
description: ( localize(
|
|
191
|
+
description: ( localize(6776, 'Description of the rule.'))
|
|
192
192
|
},
|
|
193
193
|
scope: {
|
|
194
|
-
description: ( localize(
|
|
194
|
+
description: ( localize(6777, 'Scope selector against which this rule matches.')),
|
|
195
195
|
anyOf: [
|
|
196
196
|
{
|
|
197
197
|
enum: textMateScopes
|
|
@@ -230,28 +230,28 @@ const colorThemeSchema = {
|
|
|
230
230
|
allowTrailingCommas: true,
|
|
231
231
|
properties: {
|
|
232
232
|
colors: {
|
|
233
|
-
description: ( localize(
|
|
233
|
+
description: ( localize(6778, 'Colors in the workbench')),
|
|
234
234
|
$ref: workbenchColorsSchemaId,
|
|
235
235
|
additionalProperties: false
|
|
236
236
|
},
|
|
237
237
|
tokenColors: {
|
|
238
238
|
anyOf: [{
|
|
239
239
|
type: 'string',
|
|
240
|
-
description: ( localize(
|
|
240
|
+
description: ( localize(6779, 'Path to a tmTheme file (relative to the current file).'))
|
|
241
241
|
},
|
|
242
242
|
{
|
|
243
|
-
description: ( localize(
|
|
243
|
+
description: ( localize(6780, 'Colors for syntax highlighting')),
|
|
244
244
|
$ref: textmateColorsSchemaId
|
|
245
245
|
}
|
|
246
246
|
]
|
|
247
247
|
},
|
|
248
248
|
semanticHighlighting: {
|
|
249
249
|
type: 'boolean',
|
|
250
|
-
description: ( localize(
|
|
250
|
+
description: ( localize(6781, 'Whether semantic highlighting should be enabled for this theme.'))
|
|
251
251
|
},
|
|
252
252
|
semanticTokenColors: {
|
|
253
253
|
type: 'object',
|
|
254
|
-
description: ( localize(
|
|
254
|
+
description: ( localize(6782, 'Colors for semantic tokens')),
|
|
255
255
|
$ref: tokenStylingSchemaId
|
|
256
256
|
}
|
|
257
257
|
}
|