Move icon theme down to editor/platform. Fixes #61031
This commit is contained in:
parent
faf868edf4
commit
994eaadcb9
7 changed files with 72 additions and 18 deletions
|
@ -10,7 +10,7 @@ import * as dom from 'vs/base/browser/dom';
|
|||
import { TokenizationRegistry } from 'vs/editor/common/modes';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { Extensions, IColorRegistry, ColorIdentifier } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { Extensions as ThemingExtensions, IThemingRegistry, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
|
||||
import { Extensions as ThemingExtensions, IThemingRegistry, ICssStyleCollector, IIconTheme } from 'vs/platform/theme/common/themeService';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
|
@ -163,10 +163,12 @@ export class StandaloneThemeServiceImpl implements IStandaloneThemeService {
|
|||
private _styleElement: HTMLStyleElement;
|
||||
private _theme: IStandaloneTheme;
|
||||
private readonly _onThemeChange: Emitter<IStandaloneTheme>;
|
||||
private readonly _onIconThemeChange: Emitter<IIconTheme>;
|
||||
private environment: IEnvironmentService = Object.create(null);
|
||||
|
||||
constructor() {
|
||||
this._onThemeChange = new Emitter<IStandaloneTheme>();
|
||||
this._onIconThemeChange = new Emitter<IIconTheme>();
|
||||
|
||||
this._knownThemes = new Map<string, StandaloneTheme>();
|
||||
this._knownThemes.set(VS_THEME_NAME, newBuiltInTheme(VS_THEME_NAME));
|
||||
|
@ -239,4 +241,16 @@ export class StandaloneThemeServiceImpl implements IStandaloneThemeService {
|
|||
|
||||
return theme.id;
|
||||
}
|
||||
|
||||
public getIconTheme(): IIconTheme {
|
||||
return {
|
||||
hasFileIcons: false,
|
||||
hasFolderIcons: false,
|
||||
hidesExplorerArrows: false
|
||||
};
|
||||
}
|
||||
|
||||
public get onIconThemeChange(): Event<IIconTheme> {
|
||||
return this._onIconThemeChange.event;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
import * as assert from 'assert';
|
||||
import { TokenizationSupport2Adapter, TokensProvider, ILineTokens, IToken } from 'vs/editor/standalone/browser/standaloneLanguages';
|
||||
import { IStandaloneThemeService, IStandaloneThemeData, IStandaloneTheme } from 'vs/editor/standalone/common/standaloneThemeService';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { ITheme, LIGHT } from 'vs/platform/theme/common/themeService';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { ITheme, LIGHT, IIconTheme } from 'vs/platform/theme/common/themeService';
|
||||
import { LanguageIdentifier, LanguageId, IState, MetadataConsts } from 'vs/editor/common/modes';
|
||||
import { Token } from 'vs/editor/common/core/token';
|
||||
import { TokenTheme } from 'vs/editor/common/modes/supports/tokenization';
|
||||
|
@ -56,7 +56,15 @@ suite('TokenizationSupport2Adapter', () => {
|
|||
}
|
||||
};
|
||||
}
|
||||
public readonly onThemeChange: Event<ITheme> | null = null;
|
||||
public getIconTheme(): IIconTheme {
|
||||
return {
|
||||
hasFileIcons: false,
|
||||
hasFolderIcons: false,
|
||||
hidesExplorerArrows: false
|
||||
};
|
||||
}
|
||||
public readonly onThemeChange = new Emitter<ITheme>().event;
|
||||
public readonly onIconThemeChange = new Emitter<IIconTheme>().event;
|
||||
}
|
||||
|
||||
class MockState implements IState {
|
||||
|
|
|
@ -61,6 +61,12 @@ export interface ITheme {
|
|||
defines(color: ColorIdentifier): boolean;
|
||||
}
|
||||
|
||||
export interface IIconTheme {
|
||||
readonly hasFileIcons: boolean;
|
||||
readonly hasFolderIcons: boolean;
|
||||
readonly hidesExplorerArrows: boolean;
|
||||
}
|
||||
|
||||
export interface ICssStyleCollector {
|
||||
addRule(rule: string): void;
|
||||
}
|
||||
|
@ -74,10 +80,11 @@ export interface IThemeService {
|
|||
|
||||
getTheme(): ITheme;
|
||||
|
||||
/**
|
||||
* Register a theming participant that is invoked after every theme change.
|
||||
*/
|
||||
onThemeChange: Event<ITheme>;
|
||||
readonly onThemeChange: Event<ITheme>;
|
||||
|
||||
getIconTheme(): IIconTheme;
|
||||
|
||||
readonly onIconThemeChange: Event<IIconTheme>;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IThemeService, ITheme, DARK } from 'vs/platform/theme/common/themeService';
|
||||
import { IThemeService, ITheme, DARK, IIconTheme } from 'vs/platform/theme/common/themeService';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
|
||||
export class TestTheme implements ITheme {
|
||||
|
@ -25,14 +25,23 @@ export class TestTheme implements ITheme {
|
|||
}
|
||||
}
|
||||
|
||||
export class TestIconTheme implements IIconTheme {
|
||||
hasFileIcons = false;
|
||||
hasFolderIcons = false;
|
||||
hidesExplorerArrows = false;
|
||||
}
|
||||
|
||||
export class TestThemeService implements IThemeService {
|
||||
|
||||
_serviceBrand: any;
|
||||
_theme: ITheme;
|
||||
_iconTheme: IIconTheme;
|
||||
_onThemeChange = new Emitter<ITheme>();
|
||||
_onIconThemeChange = new Emitter<IIconTheme>();
|
||||
|
||||
constructor(theme = new TestTheme()) {
|
||||
constructor(theme = new TestTheme(), iconTheme = new TestIconTheme()) {
|
||||
this._theme = theme;
|
||||
this._iconTheme = iconTheme;
|
||||
}
|
||||
|
||||
getTheme(): ITheme {
|
||||
|
@ -51,4 +60,12 @@ export class TestThemeService implements IThemeService {
|
|||
public get onThemeChange(): Event<ITheme> {
|
||||
return this._onThemeChange.event;
|
||||
}
|
||||
|
||||
getIconTheme(): IIconTheme {
|
||||
return this._iconTheme;
|
||||
}
|
||||
|
||||
public get onIconThemeChange(): Event<IIconTheme> {
|
||||
return this._onIconThemeChange.event;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { ITheme, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { ITheme, IThemeService, IIconTheme } from 'vs/platform/theme/common/themeService';
|
||||
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
export const IWorkbenchThemeService = createDecorator<IWorkbenchThemeService>('themeService');
|
||||
|
@ -38,7 +38,7 @@ export interface IColorMap {
|
|||
[id: string]: Color;
|
||||
}
|
||||
|
||||
export interface IFileIconTheme {
|
||||
export interface IFileIconTheme extends IIconTheme {
|
||||
readonly id: string;
|
||||
readonly label: string;
|
||||
readonly settingsId: string;
|
||||
|
@ -46,9 +46,9 @@ export interface IFileIconTheme {
|
|||
readonly extensionData: ExtensionData;
|
||||
|
||||
readonly isLoaded: boolean;
|
||||
readonly hasFileIcons?: boolean;
|
||||
readonly hasFolderIcons?: boolean;
|
||||
readonly hidesExplorerArrows?: boolean;
|
||||
readonly hasFileIcons: boolean;
|
||||
readonly hasFolderIcons: boolean;
|
||||
readonly hidesExplorerArrows: boolean;
|
||||
}
|
||||
|
||||
export interface IWorkbenchThemeService extends IThemeService {
|
||||
|
|
|
@ -17,9 +17,9 @@ export class FileIconThemeData implements IFileIconTheme {
|
|||
label: string;
|
||||
settingsId: string;
|
||||
description?: string;
|
||||
hasFileIcons?: boolean;
|
||||
hasFolderIcons?: boolean;
|
||||
hidesExplorerArrows?: boolean;
|
||||
hasFileIcons: boolean;
|
||||
hasFolderIcons: boolean;
|
||||
hidesExplorerArrows: boolean;
|
||||
isLoaded: boolean;
|
||||
location?: URI;
|
||||
extensionData: ExtensionData;
|
||||
|
|
|
@ -191,6 +191,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
|
|||
return this.onFileIconThemeChange.event;
|
||||
}
|
||||
|
||||
public get onIconThemeChange(): Event<IFileIconTheme> {
|
||||
return this.onFileIconThemeChange.event;
|
||||
}
|
||||
|
||||
public get onThemeChange(): Event<ITheme> {
|
||||
return this.onColorThemeChange.event;
|
||||
}
|
||||
|
@ -394,6 +398,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
|
|||
return this.currentIconTheme;
|
||||
}
|
||||
|
||||
public getIconTheme() {
|
||||
return this.currentIconTheme;
|
||||
}
|
||||
|
||||
public setFileIconTheme(iconTheme: string, settingsTarget: ConfigurationTarget): Thenable<IFileIconTheme> {
|
||||
iconTheme = iconTheme || '';
|
||||
if (iconTheme === this.currentIconTheme.id && this.currentIconTheme.isLoaded) {
|
||||
|
|
Loading…
Reference in a new issue