提交 802041ed 编写于 作者: M Martin Aeschlimann 提交者: GitHub

Merge pull request #26656 from Microsoft/aeschli/remove-editorconfig-theme

[theme] remove editorOptions.theme
......@@ -44,12 +44,26 @@ export interface IEditorConstructionOptions extends IEditorOptions {
* To not create automatically a model, use `model: null`.
*/
language?: string;
/**
* Initial theme to be used for rendering.
* The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
* You can create custom themes via `monaco.editor.defineTheme`.
* To switch a theme, use `monaco.editor.setTheme`
*/
theme?: string;
}
/**
* The options to create a diff editor.
*/
export interface IDiffEditorConstructionOptions extends IDiffEditorOptions {
/**
* Initial theme to be used for rendering.
* The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
* You can create custom themes via `monaco.editor.defineTheme`.
* To switch a theme, use `monaco.editor.setTheme`
*/
theme?: string;
}
export interface IStandaloneCodeEditor extends ICodeEditor {
......@@ -193,7 +207,6 @@ export class StandaloneCodeEditor extends CodeEditor implements IStandaloneCodeE
export class StandaloneEditor extends StandaloneCodeEditor implements IStandaloneCodeEditor {
private _contextViewService: IEditorContextViewService;
private _standaloneThemeService: IStandaloneThemeService;
private _ownsModel: boolean;
constructor(
......@@ -206,18 +219,17 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
@IContextKeyService contextKeyService: IContextKeyService,
@IKeybindingService keybindingService: IKeybindingService,
@IContextViewService contextViewService: IContextViewService,
@IStandaloneThemeService standaloneThemeService: IStandaloneThemeService
@IStandaloneThemeService themeService: IStandaloneThemeService
) {
options = options || {};
if (typeof options.theme === 'string') {
options.theme = standaloneThemeService.setTheme(options.theme);
themeService.setTheme(options.theme);
}
let model: IModel = options.model;
delete options.model;
super(domElement, options, instantiationService, codeEditorService, commandService, contextKeyService, keybindingService, standaloneThemeService);
super(domElement, options, instantiationService, codeEditorService, commandService, contextKeyService, keybindingService, themeService);
this._contextViewService = <IEditorContextViewService>contextViewService;
this._standaloneThemeService = standaloneThemeService;
this._register(toDispose);
if (typeof model === 'undefined') {
......@@ -245,13 +257,6 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
this.dispose();
}
public updateOptions(newOptions: IEditorOptions): void {
if (typeof newOptions.theme === 'string') {
newOptions.theme = this._standaloneThemeService.setTheme(newOptions.theme);
}
super.updateOptions(newOptions);
}
_attachModel(model: IModel): void {
super._attachModel(model);
if (this._view) {
......@@ -271,7 +276,6 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
export class StandaloneDiffEditor extends DiffEditorWidget implements IStandaloneDiffEditor {
private _contextViewService: IEditorContextViewService;
private _standaloneThemeService: IStandaloneThemeService;
private _standaloneKeybindingService: StandaloneKeybindingService;
constructor(
......@@ -282,14 +286,13 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
@IContextKeyService contextKeyService: IContextKeyService,
@IKeybindingService keybindingService: IKeybindingService,
@IContextViewService contextViewService: IContextViewService,
@IStandaloneThemeService standaloneColorService: IStandaloneThemeService,
@IEditorWorkerService editorWorkerService: IEditorWorkerService,
@ICodeEditorService codeEditorService: ICodeEditorService,
@IThemeService themeService: IThemeService
@IStandaloneThemeService themeService: IStandaloneThemeService
) {
options = options || {};
if (typeof options.theme === 'string') {
options.theme = standaloneColorService.setTheme(options.theme);
options.theme = themeService.setTheme(options.theme);
}
super(domElement, options, editorWorkerService, contextKeyService, instantiationService, codeEditorService, themeService);
......@@ -299,7 +302,6 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
}
this._contextViewService = <IEditorContextViewService>contextViewService;
this._standaloneThemeService = standaloneColorService;
this._register(toDispose);
......@@ -314,13 +316,6 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
this.dispose();
}
public updateOptions(newOptions: IEditorOptions): void {
if (typeof newOptions.theme === 'string') {
newOptions.theme = this._standaloneThemeService.setTheme(newOptions.theme);
}
super.updateOptions(newOptions);
}
protected _createInnerEditor(instantiationService: IInstantiationService, container: HTMLElement, options: IEditorOptions): CodeEditor {
return instantiationService.createInstance(StandaloneCodeEditor, container, options);
}
......
......@@ -125,7 +125,6 @@ export function createDiffEditor(domElement: HTMLElement, options?: IDiffEditorC
services.get(IContextKeyService),
services.get(IKeybindingService),
services.get(IContextViewService),
services.get(IStandaloneThemeService),
services.get(IEditorWorkerService),
services.get(ICodeEditorService),
services.get(IStandaloneThemeService)
......@@ -309,6 +308,13 @@ export function defineTheme(themeName: string, themeData: IStandaloneThemeData):
StaticServices.standaloneThemeService.get().defineTheme(themeName, themeData);
}
/**
* Switches to a theme.
*/
export function setTheme(themeName: string): void {
StaticServices.standaloneThemeService.get().setTheme(themeName);
}
/**
* @internal
*/
......@@ -336,6 +342,7 @@ export function createMonacoEditorAPI(): typeof monaco.editor {
colorizeModelLine: colorizeModelLine,
tokenize: tokenize,
defineTheme: defineTheme,
setTheme: setTheme,
// enums
ScrollbarVisibility: ScrollbarVisibility,
......
......@@ -48,7 +48,7 @@ import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData'
import { EditorScrollbar } from 'vs/editor/browser/viewParts/editorScrollbar/editorScrollbar';
import { Minimap } from 'vs/editor/browser/viewParts/minimap/minimap';
import * as viewEvents from 'vs/editor/common/view/viewEvents';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IThemeService, getThemeTypeSelector } from 'vs/platform/theme/common/themeService';
export interface IContentWidgetData {
widget: editorBrowser.IContentWidget;
......@@ -118,6 +118,7 @@ export class View extends ViewEventHandler {
this._register(themeService.onThemeChange(theme => {
this._context.theme = theme;
this.eventDispatcher.emit(new viewEvents.ViewThemeChangedEvent());
this.render(true, false);
}));
this.viewParts = [];
......@@ -144,7 +145,7 @@ export class View extends ViewEventHandler {
this.linesContent.setPosition('absolute');
this.domNode = createFastDomNode(document.createElement('div'));
this.domNode.setClassName(this._context.configuration.editor.editorClassName);
this.domNode.setClassName(this.getEditorClassName());
this.overflowGuardContainer = createFastDomNode(document.createElement('div'));
PartFingerprints.write(this.overflowGuardContainer, PartFingerprint.OverflowGuard);
......@@ -305,11 +306,15 @@ export class View extends ViewEventHandler {
}
private getEditorClassName() {
return this._context.configuration.editor.editorClassName + ' ' + getThemeTypeSelector(this._context.theme.type);
}
// --- begin event handlers
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
if (e.editorClassName) {
this.domNode.setClassName(this._context.configuration.editor.editorClassName);
this.domNode.setClassName(this.getEditorClassName());
}
if (e.layoutInfo) {
this._setLayout();
......@@ -329,6 +334,10 @@ export class View extends ViewEventHandler {
this.outgoingEvents.emitScrollChanged(e);
return false;
}
public onThemeChanged(e: viewEvents.ViewThemeChangedEvent): boolean {
this.domNode.setClassName(this.getEditorClassName());
return false;
}
// --- end event handlers
......
......@@ -158,16 +158,6 @@ export abstract class CodeEditorWidget extends CommonCodeEditor implements edito
super.dispose();
}
public updateOptions(newOptions: IEditorOptions): void {
let oldTheme = this._configuration.editor.viewInfo.theme;
super.updateOptions(newOptions);
let newTheme = this._configuration.editor.viewInfo.theme;
if (oldTheme !== newTheme) {
this.render();
}
}
public colorizeModelLine(lineNumber: number, model: editorCommon.IModel = this.model): string {
if (!model) {
return '';
......
......@@ -32,7 +32,7 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
import { ColorId, MetadataConsts, FontStyle } from 'vs/editor/common/modes';
import Event, { Emitter } from 'vs/base/common/event';
import * as editorOptions from 'vs/editor/common/config/editorOptions';
import { registerThemingParticipant, IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
import { registerThemingParticipant, IThemeService, ITheme, getThemeTypeSelector } from 'vs/platform/theme/common/themeService';
import { registerColor, scrollbarShadow } from 'vs/platform/theme/common/colorRegistry';
import { Color, RGBA } from 'vs/base/common/color';
import { OverviewRulerZone } from 'vs/editor/common/view/overviewZoneManager';
......@@ -148,7 +148,6 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
private readonly id: number;
private _theme: string;
private _domElement: HTMLElement;
protected readonly _containerDomElement: HTMLElement;
private readonly _overviewDomElement: HTMLElement;
......@@ -213,7 +212,6 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this._domElement = domElement;
options = options || {};
this._theme = options.theme || editorOptions.EDITOR_DEFAULTS.viewInfo.theme;
// renderSideBySide
this._renderSideBySide = true;
if (typeof options.renderSideBySide !== 'undefined') {
......@@ -240,7 +238,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this._updateDecorationsRunner = this._register(new RunOnceScheduler(() => this._updateDecorations(), 0));
this._containerDomElement = document.createElement('div');
this._containerDomElement.className = DiffEditorWidget._getClassName(this._theme, this._renderSideBySide);
this._containerDomElement.className = DiffEditorWidget._getClassName(this._themeService.getTheme(), this._renderSideBySide);
this._containerDomElement.style.position = 'relative';
this._containerDomElement.style.height = '100%';
this._domElement.appendChild(this._containerDomElement);
......@@ -305,11 +303,12 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this._codeEditorService.addDiffEditor(this);
themeService.onThemeChange(t => {
this._register(themeService.onThemeChange(t => {
if (this._strategy && this._strategy.applyColors(t)) {
this._updateDecorationsRunner.schedule();
}
});
this._containerDomElement.className = DiffEditorWidget._getClassName(this._themeService.getTheme(), this._renderSideBySide);
}));
}
public get ignoreTrimWhitespace(): boolean {
......@@ -324,12 +323,12 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
return this._renderIndicators;
}
private static _getClassName(theme: string, renderSideBySide: boolean): string {
private static _getClassName(theme: ITheme, renderSideBySide: boolean): string {
let result = 'monaco-diff-editor monaco-editor-background ';
if (renderSideBySide) {
result += 'side-by-side ';
}
result += theme;
result += getThemeTypeSelector(theme.type);
return result;
}
......@@ -486,8 +485,6 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
}
public updateOptions(newOptions: editorOptions.IDiffEditorOptions): void {
// Handle new theme
this._theme = newOptions && newOptions.theme ? newOptions.theme : this._theme;
// Handle side by side
let renderSideBySideChanged = false;
......@@ -523,9 +520,6 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this._originalIsEditable = Boolean(newOptions.originalEditable);
}
// Update class name
this._containerDomElement.className = DiffEditorWidget._getClassName(this._theme, this._renderSideBySide);
this.modifiedEditor.updateOptions(this._adjustOptionsForRightHandSide(newOptions));
this.originalEditor.updateOptions(this._adjustOptionsForLeftHandSide(newOptions, this._originalIsEditable));
......@@ -542,6 +536,8 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
} else {
this._setStrategy(new DiffEdtorWidgetInline(this._createDataSource(), this._enableSplitViewResizing));
}
// Update class name
this._containerDomElement.className = DiffEditorWidget._getClassName(this._themeService.getTheme(), this._renderSideBySide);
}
}
......@@ -892,7 +888,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
let result = this._adjustOptionsForSubEditor(options);
result.readOnly = !isEditable;
result.overviewRulerLanes = 1;
result.theme = this._theme + ' original-in-monaco-diff-editor';
result.extraEditorClassName = 'original-in-monaco-diff-editor';
return result;
}
......@@ -900,7 +896,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
let result = this._adjustOptionsForSubEditor(options);
result.revealHorizontalRightPadding = editorOptions.EDITOR_DEFAULTS.viewInfo.revealHorizontalRightPadding + DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH;
result.scrollbar.verticalHasArrows = false;
result.theme = this._theme + ' modified-in-monaco-diff-editor';
result.extraEditorClassName = 'modified-in-monaco-diff-editor';
return result;
}
......
......@@ -111,12 +111,11 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
const opts = this._validatedOptions;
const partialEnv = this._getEnvConfiguration();
const bareFontInfo = BareFontInfo.createFromRawSettings(this._rawOptions, partialEnv.zoomLevel);
const editorClassName = this._getEditorClassName(opts.viewInfo.theme, opts.viewInfo.fontLigatures, opts.mouseStyle);
const env: editorOptions.IEnvironmentalOptions = {
outerWidth: partialEnv.outerWidth,
outerHeight: partialEnv.outerHeight,
fontInfo: this.readConfiguration(bareFontInfo),
editorClassName: editorClassName + ' ' + partialEnv.extraEditorClassName,
extraEditorClassName: partialEnv.extraEditorClassName,
isDominatedByLongLines: this._isDominatedByLongLines,
lineNumbersDigitCount: this._lineNumbersDigitCount,
canUseTranslate3d: partialEnv.canUseTranslate3d,
......@@ -154,20 +153,6 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
}
return r ? r : 1;
}
private _getEditorClassName(theme: string, fontLigatures: boolean, mouseStyle: 'text' | 'default' | 'copy'): string {
let extra = '';
if (fontLigatures) {
extra += 'enable-ligatures ';
}
if (mouseStyle === 'default') {
extra += 'mouse-default ';
} else if (mouseStyle === 'copy') {
extra += 'mouse-copy ';
}
return 'monaco-editor ' + extra + theme;
}
protected abstract _getEnvConfiguration(): IEnvConfiguration;
protected abstract readConfiguration(styling: BareFontInfo): FontInfo;
......
......@@ -170,11 +170,9 @@ export interface IEditorOptions {
*/
roundedSelection?: boolean;
/**
* Theme to be used for rendering.
* The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
* You can create custom themes via `monaco.editor.defineTheme`.
* Class name to be added to the editor.
*/
theme?: string;
extraEditorClassName?: string;
/**
* Should the editor be read only.
* Defaults to false.
......@@ -683,7 +681,7 @@ export interface EditorWrappingInfo {
}
export interface InternalEditorViewOptions {
readonly theme: string;
readonly extraEditorClassName: string;
readonly disableMonospaceOptimizations: boolean;
readonly experimentalScreenReader: boolean;
readonly rulers: number[];
......@@ -893,7 +891,7 @@ export class InternalEditorOptions {
*/
private static _equalsViewOptions(a: InternalEditorViewOptions, b: InternalEditorViewOptions): boolean {
return (
a.theme === b.theme
a.extraEditorClassName === b.extraEditorClassName
&& a.disableMonospaceOptimizations === b.disableMonospaceOptimizations
&& a.experimentalScreenReader === b.experimentalScreenReader
&& this._equalsNumberArrays(a.rulers, b.rulers)
......@@ -1179,7 +1177,7 @@ export interface IEnvironmentalOptions {
readonly outerWidth: number;
readonly outerHeight: number;
readonly fontInfo: FontInfo;
readonly editorClassName: string;
readonly extraEditorClassName: string;
readonly isDominatedByLongLines: boolean;
readonly lineNumbersDigitCount: number;
readonly canUseTranslate3d: boolean;
......@@ -1473,7 +1471,7 @@ export class EditorOptionsValidator {
const minimap = this._sanitizeMinimapOpts(opts.minimap, defaults.minimap);
return {
theme: _string(opts.theme, defaults.theme),
extraEditorClassName: _string(opts.extraEditorClassName, defaults.extraEditorClassName),
disableMonospaceOptimizations: disableMonospaceOptimizations,
experimentalScreenReader: _boolean(opts.experimentalScreenReader, defaults.experimentalScreenReader),
rulers: rulers,
......@@ -1630,10 +1628,26 @@ export class InternalEditorOptionsFactory {
wordWrapBreakObtrusiveCharacters: opts.wordWrapBreakObtrusiveCharacters,
};
let className = 'monaco-editor';
if (opts.viewInfo.extraEditorClassName) {
className += ' ' + opts.viewInfo.extraEditorClassName;
}
if (env.extraEditorClassName) {
className += ' ' + env.extraEditorClassName;
}
if (opts.viewInfo.fontLigatures) {
className += ' enable-ligatures';
}
if (opts.mouseStyle === 'default') {
className += ' mouse-default';
} else if (opts.mouseStyle === 'copy') {
className += ' mouse-copy';
}
return new InternalEditorOptions({
canUseTranslate3d: opts.disableTranslate3d ? false : env.canUseTranslate3d,
pixelRatio: env.pixelRatio,
editorClassName: env.editorClassName,
editorClassName: className,
lineHeight: env.fontInfo.lineHeight,
readOnly: opts.readOnly,
wordSeparators: opts.wordSeparators,
......@@ -1853,7 +1867,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
useTabStops: true,
viewInfo: {
theme: 'vs',
extraEditorClassName: '',
disableMonospaceOptimizations: false,
experimentalScreenReader: true,
rulers: [],
......
......@@ -892,6 +892,11 @@ declare module monaco.editor {
*/
export function defineTheme(themeName: string, themeData: IStandaloneThemeData): void;
/**
* Switches to a theme.
*/
export function setTheme(themeName: string): void;
export type BuiltinTheme = 'vs' | 'vs-dark' | 'hc-black';
export interface IStandaloneThemeData {
......@@ -965,12 +970,26 @@ declare module monaco.editor {
* To not create automatically a model, use `model: null`.
*/
language?: string;
/**
* Initial theme to be used for rendering.
* The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
* You can create custom themes via `monaco.editor.defineTheme`.
* To switch a theme, use `monaco.editor.setTheme`
*/
theme?: string;
}
/**
* The options to create a diff editor.
*/
export interface IDiffEditorConstructionOptions extends IDiffEditorOptions {
/**
* Initial theme to be used for rendering.
* The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
* You can create custom themes via `monaco.editor.defineTheme`.
* To switch a theme, use `monaco.editor.setTheme`
*/
theme?: string;
}
export interface IStandaloneCodeEditor extends ICodeEditor {
......@@ -2717,11 +2736,9 @@ declare module monaco.editor {
*/
roundedSelection?: boolean;
/**
* Theme to be used for rendering.
* The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
* You can create custom themes via `monaco.editor.defineTheme`.
* Class name to be added to the editor.
*/
theme?: string;
extraEditorClassName?: string;
/**
* Should the editor be read only.
* Defaults to false.
......@@ -3163,7 +3180,7 @@ declare module monaco.editor {
}
export interface InternalEditorViewOptions {
readonly theme: string;
readonly extraEditorClassName: string;
readonly disableMonospaceOptimizations: boolean;
readonly experimentalScreenReader: boolean;
readonly rulers: number[];
......
......@@ -30,7 +30,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
......@@ -53,7 +53,7 @@ export class TextDiffEditor extends BaseTextEditor {
@IStorageService storageService: IStorageService,
@IConfigurationService configurationService: IConfigurationService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IWorkbenchThemeService themeService: IWorkbenchThemeService,
@IThemeService themeService: IThemeService,
@IEditorGroupService editorGroupService: IEditorGroupService,
@IModeService modeService: IModeService,
@ITextFileService textFileService: ITextFileService
......
......@@ -21,7 +21,7 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { Scope } from 'vs/workbench/common/memento';
import { getCodeEditor } from 'vs/editor/common/services/codeEditorService';
import { IModeService } from 'vs/editor/common/services/modeService';
......@@ -58,7 +58,7 @@ export abstract class BaseTextEditor extends BaseEditor {
@IInstantiationService private _instantiationService: IInstantiationService,
@IStorageService private storageService: IStorageService,
@IConfigurationService private _configurationService: IConfigurationService,
@IWorkbenchThemeService protected themeService: IWorkbenchThemeService,
@IThemeService protected themeService: IThemeService,
@IModeService private modeService: IModeService,
@ITextFileService private textFileService: ITextFileService,
@IEditorGroupService protected editorGroupService: IEditorGroupService
......@@ -66,7 +66,6 @@ export abstract class BaseTextEditor extends BaseEditor {
super(id, telemetryService, themeService);
this.toUnbind.push(this.configurationService.onDidUpdateConfiguration(e => this.handleConfigurationChangeEvent(e.config)));
this.toUnbind.push(themeService.onDidColorThemeChange(e => this.handleConfigurationChangeEvent())); // TODO@theme this should be done from the editor itself and not from the outside
}
protected get instantiationService(): IInstantiationService {
......@@ -125,7 +124,6 @@ export abstract class BaseTextEditor extends BaseEditor {
objects.assign(overrides, {
overviewRulerLanes: 3,
lineNumbersMinChars: 3,
theme: this.themeService.getColorTheme().id,
fixedOverflowWidgets: true
});
......
......@@ -19,7 +19,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IModeService } from 'vs/editor/common/services/modeService';
......@@ -38,7 +38,7 @@ export class TextResourceEditor extends BaseTextEditor {
@IInstantiationService instantiationService: IInstantiationService,
@IStorageService storageService: IStorageService,
@IConfigurationService configurationService: IConfigurationService,
@IWorkbenchThemeService themeService: IWorkbenchThemeService,
@IThemeService themeService: IThemeService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IEditorGroupService editorGroupService: IEditorGroupService,
@IModeService modeService: IModeService,
......
......@@ -38,11 +38,11 @@ import * as debug from 'vs/workbench/parts/debug/common/debug';
import { ClearReplAction } from 'vs/workbench/parts/debug/browser/debugActions';
import { ReplHistory } from 'vs/workbench/parts/debug/common/replHistory';
import { Panel } from 'vs/workbench/browser/panel';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { IListService } from 'vs/platform/list/browser/listService';
import { attachListStyler } from 'vs/platform/theme/common/styler';
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
import { IThemeService } from 'vs/platform/theme/common/themeService';
const $ = dom.$;
......@@ -89,7 +89,7 @@ export class Repl extends Panel implements IPrivateReplService {
@IInstantiationService private instantiationService: IInstantiationService,
@IStorageService private storageService: IStorageService,
@IPanelService private panelService: IPanelService,
@IWorkbenchThemeService protected themeService: IWorkbenchThemeService,
@IThemeService protected themeService: IThemeService,
@IModelService private modelService: IModelService,
@IContextKeyService private contextKeyService: IContextKeyService,
@IListService private listService: IListService
......@@ -105,7 +105,6 @@ export class Repl extends Panel implements IPrivateReplService {
this.toDispose.push(this.debugService.getModel().onDidChangeReplElements(() => {
this.refreshReplElements(this.debugService.getModel().getReplElements().length === 0);
}));
this.toDispose.push(this.themeService.onDidColorThemeChange(e => this.replInput.updateOptions(this.getReplInputOptions()))); // TODO@theme this should be done from the editor itself and not from the outside
this.toDispose.push(this.panelService.onDidPanelOpen(panel => this.refreshReplElements(true)));
}
......@@ -280,7 +279,6 @@ export class Repl extends Panel implements IPrivateReplService {
},
lineDecorationsWidth: 0,
scrollBeyondLastLine: false,
theme: this.themeService.getColorTheme().id,
renderLineHighlight: 'none',
fixedOverflowWidgets: true
};
......
......@@ -28,7 +28,7 @@ import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { CancelAction } from 'vs/platform/message/common/message';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IModeService } from 'vs/editor/common/services/modeService';
......@@ -49,7 +49,7 @@ export class TextFileEditor extends BaseTextEditor {
@IHistoryService private historyService: IHistoryService,
@IConfigurationService configurationService: IConfigurationService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IWorkbenchThemeService themeService: IWorkbenchThemeService,
@IThemeService themeService: IThemeService,
@IEditorGroupService editorGroupService: IEditorGroupService,
@IModeService modeService: IModeService,
@ITextFileService textFileService: ITextFileService,
......
......@@ -21,7 +21,7 @@ import { EditorInput, EditorOptions } from 'vs/workbench/common/editor';
import { TextResourceEditor } from 'vs/workbench/browser/parts/editor/textResourceEditor';
import { OutputEditors, OUTPUT_PANEL_ID, IOutputService, CONTEXT_IN_OUTPUT } from 'vs/workbench/parts/output/common/output';
import { SwitchOutputAction, SwitchOutputActionItem, ClearOutputAction, ToggleOutputScrollLockAction } from 'vs/workbench/parts/output/browser/outputActions';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IModeService } from 'vs/editor/common/services/modeService';
......@@ -37,7 +37,7 @@ export class OutputPanel extends TextResourceEditor {
@IInstantiationService instantiationService: IInstantiationService,
@IStorageService storageService: IStorageService,
@IConfigurationService configurationService: IConfigurationService,
@IWorkbenchThemeService themeService: IWorkbenchThemeService,
@IThemeService themeService: IThemeService,
@IOutputService private outputService: IOutputService,
@IUntitledEditorService untitledEditorService: IUntitledEditorService,
@IContextKeyService private contextKeyService: IContextKeyService,
......
......@@ -32,7 +32,7 @@ import { SearchWidget, SettingsTabsWidget } from 'vs/workbench/parts/preferences
import { ContextKeyExpr, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { Command } from 'vs/editor/common/editorCommonExtensions';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IStorageService } from 'vs/platform/storage/common/storage';
......@@ -114,7 +114,7 @@ export class PreferencesEditor extends BaseEditor {
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IContextKeyService private contextKeyService: IContextKeyService,
@IInstantiationService private instantiationService: IInstantiationService,
@IWorkbenchThemeService themeService: IWorkbenchThemeService
@IThemeService themeService: IThemeService
) {
super(PreferencesEditor.ID, telemetryService, themeService);
this.defaultSettingsEditorContextKey = CONTEXT_SETTINGS_EDITOR.bindTo(this.contextKeyService);
......@@ -473,7 +473,7 @@ export class DefaultPreferencesEditor extends BaseTextEditor {
@IInstantiationService instantiationService: IInstantiationService,
@IStorageService storageService: IStorageService,
@IConfigurationService configurationService: IConfigurationService,
@IWorkbenchThemeService themeService: IWorkbenchThemeService,
@IThemeService themeService: IThemeService,
@IPreferencesService private preferencesService: IPreferencesService,
@IModelService private modelService: IModelService,
@IModeService modeService: IModeService,
......
......@@ -17,7 +17,6 @@ import { EditorOptions } from 'vs/workbench/common/editor';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { WalkThroughInput } from 'vs/workbench/parts/welcome/walkThrough/node/walkThroughInput';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { marked } from 'vs/base/common/marked/marked';
import { IModeService } from 'vs/editor/common/services/modeService';
......@@ -38,7 +37,7 @@ import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'
import { Parts, IPartService } from 'vs/workbench/services/part/common/partService';
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
export const WALK_THROUGH_FOCUS = new RawContextKey<boolean>('interactivePlaygroundFocus', false);
......@@ -94,7 +93,7 @@ export class WalkThroughPart extends BaseEditor {
constructor(
@ITelemetryService telemetryService: ITelemetryService,
@IInstantiationService private instantiationService: IInstantiationService,
@IWorkbenchThemeService protected themeService: IWorkbenchThemeService,
@IThemeService protected themeService: IThemeService,
@IOpenerService private openerService: IOpenerService,
@IFileService private fileService: IFileService,
@IModelService protected modelService: IModelService,
......@@ -328,8 +327,8 @@ export class WalkThroughPart extends BaseEditor {
innerContent.classList.add('walkThroughContent'); // only for markdown files
const markdown = this.expandMacros(content);
innerContent.innerHTML = marked(markdown, { renderer });
this.style(innerContent);
this.contentDisposables.push(this.themeService.onDidColorThemeChange(() => this.style(innerContent)));
this.style(this.themeService.getTheme(), innerContent);
this.contentDisposables.push(this.themeService.onThemeChange(theme => this.style(theme, innerContent)));
this.content.appendChild(innerContent);
model.snippets.forEach((snippet, i) => {
......@@ -378,7 +377,6 @@ export class WalkThroughPart extends BaseEditor {
}
}));
this.contentDisposables.push(this.themeService.onDidColorThemeChange(theme => editor.updateOptions({ theme: theme.id }))); // TODO@theme this should be done from the editor itself and not from the outside
this.contentDisposables.push(this.configurationService.onDidUpdateConfiguration(() => editor.updateOptions(this.getEditorOptions(snippet.textEditorModel.getModeId()))));
this.contentDisposables.push(once(editor.onMouseDown)(() => {
......@@ -429,7 +427,6 @@ export class WalkThroughPart extends BaseEditor {
overviewRulerLanes: 3,
fixedOverflowWidgets: true,
lineNumbersMinChars: 1,
theme: this.themeService.getColorTheme().id,
minimap: false,
};
}
......@@ -443,7 +440,7 @@ export class WalkThroughPart extends BaseEditor {
}
}
private style(div: HTMLElement) {
private style(theme: ITheme, div: HTMLElement) {
const styleElement = this.partService.getContainer(Parts.EDITOR_PART); // TODO@theme styles should come in via theme registry
const { color, backgroundColor, fontFamily, fontWeight, fontSize } = window.getComputedStyle(styleElement);
div.style.color = color;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册