[theme] introduce IStandaloneThemeService
parent
99dafc3894
commit
b9189cadc1
|
@ -53,7 +53,7 @@ declare module monaco {
|
|||
declare module monaco.editor {
|
||||
|
||||
#includeAll(vs/editor/browser/standalone/standaloneEditor;modes.=>languages.;editorCommon.=>):
|
||||
#include(vs/editor/common/services/standaloneColorService): BuiltinTheme, IStandaloneThemeData, IColors
|
||||
#include(vs/editor/common/services/standaloneThemeService): BuiltinTheme, IStandaloneThemeData, IColors
|
||||
#include(vs/editor/common/modes/supports/tokenization): ITokenThemeRule
|
||||
#include(vs/editor/common/services/webWorker): MonacoWebWorker, IWebWorkerOptions
|
||||
#include(vs/editor/browser/standalone/standaloneCodeEditor): IEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
'use strict';
|
||||
|
||||
import { TokenTheme, ITokenThemeRule, generateTokensCSSForColorMap } from 'vs/editor/common/modes/supports/tokenization';
|
||||
import { IStandaloneColorService, BuiltinTheme, IStandaloneThemeData, IStandaloneTheme, IColors } from 'vs/editor/common/services/standaloneColorService';
|
||||
import { IStandaloneThemeService, BuiltinTheme, IStandaloneThemeData, IStandaloneTheme, IColors } from 'vs/editor/common/services/standaloneThemeService';
|
||||
import { vs, vs_dark, hc_black } from 'vs/editor/common/standalone/themes';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { TokenizationRegistry } from 'vs/editor/common/modes';
|
||||
|
@ -13,6 +13,7 @@ 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 { Registry } from 'vs/platform/platform';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
|
||||
const VS_THEME_NAME = 'vs';
|
||||
const VS_DARK_THEME_NAME = 'vs-dark';
|
||||
|
@ -114,15 +115,19 @@ function newBuiltInTheme(builtinTheme: BuiltinTheme): StandaloneTheme {
|
|||
return new StandaloneTheme(builtinTheme, '', themeData.colors, themeData.rules);
|
||||
}
|
||||
|
||||
export class StandaloneColorServiceImpl implements IStandaloneColorService {
|
||||
export class StandaloneThemeServiceImpl implements IStandaloneThemeService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
private _knownThemes: Map<string, StandaloneTheme>;
|
||||
private _styleElement: HTMLStyleElement;
|
||||
private _theme: IStandaloneTheme;
|
||||
private _onThemeChange: Emitter<IStandaloneTheme>;
|
||||
|
||||
|
||||
constructor() {
|
||||
this._onThemeChange = new Emitter<IStandaloneTheme>();
|
||||
|
||||
this._knownThemes = new Map<string, StandaloneTheme>();
|
||||
this._knownThemes.set(VS_THEME_NAME, newBuiltInTheme(VS_THEME_NAME));
|
||||
this._knownThemes.set(VS_DARK_THEME_NAME, newBuiltInTheme(VS_DARK_THEME_NAME));
|
||||
|
@ -132,6 +137,10 @@ export class StandaloneColorServiceImpl implements IStandaloneColorService {
|
|||
this.setTheme(VS_THEME_NAME);
|
||||
}
|
||||
|
||||
public get onThemeChange(): Event<IStandaloneTheme> {
|
||||
return this._onThemeChange.event;
|
||||
}
|
||||
|
||||
public defineTheme(themeName: string, themeData: IStandaloneThemeData): void {
|
||||
if (!/^[a-z0-9\-]+$/i.test(themeName) || isBuiltinTheme(themeName)) {
|
||||
throw new Error('Illegal theme name!');
|
||||
|
@ -189,6 +198,7 @@ export class StandaloneColorServiceImpl implements IStandaloneColorService {
|
|||
this._styleElement.innerHTML = cssRules.join('\n');
|
||||
|
||||
TokenizationRegistry.setColorMap(colorMap);
|
||||
this._onThemeChange.fire(theme);
|
||||
|
||||
return theme.id;
|
||||
}
|
|
@ -13,7 +13,7 @@ import { renderViewLine, RenderLineInput } from 'vs/editor/common/viewLayout/vie
|
|||
import { ViewLineToken } from 'vs/editor/common/core/viewLineToken';
|
||||
import { LineTokens } from 'vs/editor/common/core/lineTokens';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { IStandaloneColorService } from 'vs/editor/common/services/standaloneColorService';
|
||||
import { IStandaloneThemeService } from 'vs/editor/common/services/standaloneThemeService';
|
||||
|
||||
export interface IColorizerOptions {
|
||||
tabSize?: number;
|
||||
|
@ -26,7 +26,7 @@ export interface IColorizerElementOptions extends IColorizerOptions {
|
|||
|
||||
export class Colorizer {
|
||||
|
||||
public static colorizeElement(standaloneColorService: IStandaloneColorService, modeService: IModeService, domNode: HTMLElement, options: IColorizerElementOptions): TPromise<void> {
|
||||
public static colorizeElement(themeService: IStandaloneThemeService, modeService: IModeService, domNode: HTMLElement, options: IColorizerElementOptions): TPromise<void> {
|
||||
options = options || {};
|
||||
let theme = options.theme || 'vs';
|
||||
let mimeType = options.mimeType || domNode.getAttribute('lang') || domNode.getAttribute('data-lang');
|
||||
|
@ -35,7 +35,7 @@ export class Colorizer {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
standaloneColorService.setTheme(theme);
|
||||
themeService.setTheme(theme);
|
||||
|
||||
let text = domNode.firstChild.nodeValue;
|
||||
domNode.className += 'monaco-editor ' + theme;
|
||||
|
|
|
@ -20,7 +20,7 @@ import { IEditorContextViewService } from 'vs/editor/browser/standalone/standalo
|
|||
import { CodeEditor } from 'vs/editor/browser/codeEditor';
|
||||
import { DiffEditorWidget } from 'vs/editor/browser/widget/diffEditorWidget';
|
||||
import { ICodeEditor, IDiffEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { IStandaloneColorService } from 'vs/editor/common/services/standaloneColorService';
|
||||
import { IStandaloneThemeService } from 'vs/editor/common/services/standaloneThemeService';
|
||||
import { InternalEditorAction } from 'vs/editor/common/editorAction';
|
||||
import { MenuId, MenuRegistry, IMenuItem } from 'vs/platform/actions/common/actions';
|
||||
|
||||
|
@ -185,7 +185,7 @@ export class StandaloneCodeEditor extends CodeEditor implements IStandaloneCodeE
|
|||
export class StandaloneEditor extends StandaloneCodeEditor implements IStandaloneCodeEditor {
|
||||
|
||||
private _contextViewService: IEditorContextViewService;
|
||||
private _standaloneColorService: IStandaloneColorService;
|
||||
private _standaloneThemeService: IStandaloneThemeService;
|
||||
private _ownsModel: boolean;
|
||||
private _toDispose2: IDisposable[];
|
||||
|
||||
|
@ -199,17 +199,17 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
|
|||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IKeybindingService keybindingService: IKeybindingService,
|
||||
@IContextViewService contextViewService: IContextViewService,
|
||||
@IStandaloneColorService standaloneColorService: IStandaloneColorService
|
||||
@IStandaloneThemeService standaloneThemeService: IStandaloneThemeService
|
||||
) {
|
||||
options = options || {};
|
||||
if (typeof options.theme === 'string') {
|
||||
options.theme = standaloneColorService.setTheme(options.theme);
|
||||
options.theme = standaloneThemeService.setTheme(options.theme);
|
||||
}
|
||||
|
||||
super(domElement, options, instantiationService, codeEditorService, commandService, contextKeyService, keybindingService);
|
||||
|
||||
this._contextViewService = <IEditorContextViewService>contextViewService;
|
||||
this._standaloneColorService = standaloneColorService;
|
||||
this._standaloneThemeService = standaloneThemeService;
|
||||
this._toDispose2 = [toDispose];
|
||||
|
||||
let model: IModel = null;
|
||||
|
@ -243,7 +243,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
|
|||
|
||||
public updateOptions(newOptions: IEditorOptions): void {
|
||||
if (typeof newOptions.theme === 'string') {
|
||||
newOptions.theme = this._standaloneColorService.setTheme(newOptions.theme);
|
||||
newOptions.theme = this._standaloneThemeService.setTheme(newOptions.theme);
|
||||
}
|
||||
super.updateOptions(newOptions);
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
|
|||
export class StandaloneDiffEditor extends DiffEditorWidget implements IStandaloneDiffEditor {
|
||||
|
||||
private _contextViewService: IEditorContextViewService;
|
||||
private _standaloneColorService: IStandaloneColorService;
|
||||
private _standaloneThemeService: IStandaloneThemeService;
|
||||
private _standaloneKeybindingService: StandaloneKeybindingService;
|
||||
private _toDispose2: IDisposable[];
|
||||
|
||||
|
@ -279,7 +279,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
|
|||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IKeybindingService keybindingService: IKeybindingService,
|
||||
@IContextViewService contextViewService: IContextViewService,
|
||||
@IStandaloneColorService standaloneColorService: IStandaloneColorService,
|
||||
@IStandaloneThemeService standaloneColorService: IStandaloneThemeService,
|
||||
@IEditorWorkerService editorWorkerService: IEditorWorkerService
|
||||
) {
|
||||
options = options || {};
|
||||
|
@ -294,7 +294,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
|
|||
}
|
||||
|
||||
this._contextViewService = <IEditorContextViewService>contextViewService;
|
||||
this._standaloneColorService = standaloneColorService;
|
||||
this._standaloneThemeService = standaloneColorService;
|
||||
|
||||
this._toDispose2 = [toDispose];
|
||||
|
||||
|
@ -312,7 +312,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
|
|||
|
||||
public updateOptions(newOptions: IEditorOptions): void {
|
||||
if (typeof newOptions.theme === 'string') {
|
||||
newOptions.theme = this._standaloneColorService.setTheme(newOptions.theme);
|
||||
newOptions.theme = this._standaloneThemeService.setTheme(newOptions.theme);
|
||||
}
|
||||
super.updateOptions(newOptions);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'
|
|||
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
|
||||
import { ITextModelResolverService } from 'vs/editor/common/services/resolverService';
|
||||
import { NULL_STATE, nullTokenize } from 'vs/editor/common/modes/nullMode';
|
||||
import { IStandaloneThemeData, IStandaloneColorService } from 'vs/editor/common/services/standaloneColorService';
|
||||
import { IStandaloneThemeData, IStandaloneThemeService } from 'vs/editor/common/services/standaloneThemeService';
|
||||
import { Token } from 'vs/editor/common/core/token';
|
||||
import { FontInfo, BareFontInfo } from 'vs/editor/common/config/fontInfo';
|
||||
|
||||
|
@ -92,7 +92,7 @@ export function create(domElement: HTMLElement, options?: IEditorConstructionOpt
|
|||
services.get(IContextKeyService),
|
||||
services.get(IKeybindingService),
|
||||
services.get(IContextViewService),
|
||||
services.get(IStandaloneColorService)
|
||||
services.get(IStandaloneThemeService)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ export function createDiffEditor(domElement: HTMLElement, options?: IDiffEditorC
|
|||
services.get(IContextKeyService),
|
||||
services.get(IKeybindingService),
|
||||
services.get(IContextViewService),
|
||||
services.get(IStandaloneColorService),
|
||||
services.get(IStandaloneThemeService),
|
||||
services.get(IEditorWorkerService)
|
||||
);
|
||||
});
|
||||
|
@ -244,7 +244,7 @@ export function createWebWorker<T>(opts: IWebWorkerOptions): MonacoWebWorker<T>
|
|||
* Colorize the contents of `domNode` using attribute `data-lang`.
|
||||
*/
|
||||
export function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): TPromise<void> {
|
||||
return Colorizer.colorizeElement(StaticServices.standaloneColorService.get(), StaticServices.modeService.get(), domNode, options);
|
||||
return Colorizer.colorizeElement(StaticServices.standaloneThemeService.get(), StaticServices.modeService.get(), domNode, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -302,7 +302,7 @@ export function tokenize(text: string, languageId: string): Token[][] {
|
|||
* Define a new theme.
|
||||
*/
|
||||
export function defineTheme(themeName: string, themeData: IStandaloneThemeData): void {
|
||||
StaticServices.standaloneColorService.get().defineTheme(themeName, themeData);
|
||||
StaticServices.standaloneThemeService.get().defineTheme(themeName, themeData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,7 +23,7 @@ import { createTokenizationSupport } from 'vs/editor/common/modes/monarch/monarc
|
|||
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
import { IMarkerData } from 'vs/platform/markers/common/markers';
|
||||
import { Token, TokenizationResult, TokenizationResult2 } from 'vs/editor/common/core/token';
|
||||
import { IStandaloneColorService } from 'vs/editor/common/services/standaloneColorService';
|
||||
import { IStandaloneThemeService } from 'vs/editor/common/services/standaloneThemeService';
|
||||
|
||||
/**
|
||||
* Register information about a new language.
|
||||
|
@ -73,12 +73,12 @@ export function setLanguageConfiguration(languageId: string, configuration: Lang
|
|||
*/
|
||||
export class TokenizationSupport2Adapter implements modes.ITokenizationSupport {
|
||||
|
||||
private readonly _standaloneColorService: IStandaloneColorService;
|
||||
private readonly _standaloneThemeService: IStandaloneThemeService;
|
||||
private readonly _languageIdentifier: modes.LanguageIdentifier;
|
||||
private readonly _actual: TokensProvider;
|
||||
|
||||
constructor(standaloneColorService: IStandaloneColorService, languageIdentifier: modes.LanguageIdentifier, actual: TokensProvider) {
|
||||
this._standaloneColorService = standaloneColorService;
|
||||
constructor(standaloneThemeService: IStandaloneThemeService, languageIdentifier: modes.LanguageIdentifier, actual: TokensProvider) {
|
||||
this._standaloneThemeService = standaloneThemeService;
|
||||
this._languageIdentifier = languageIdentifier;
|
||||
this._actual = actual;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ export class TokenizationSupport2Adapter implements modes.ITokenizationSupport {
|
|||
|
||||
private _toBinaryTokens(tokens: IToken[], offsetDelta: number): Uint32Array {
|
||||
let languageId = this._languageIdentifier.id;
|
||||
let tokenTheme = this._standaloneColorService.getTheme().tokenTheme;
|
||||
let tokenTheme = this._standaloneThemeService.getTheme().tokenTheme;
|
||||
|
||||
let result: number[] = [], resultLen = 0;
|
||||
for (let i = 0, len = tokens.length; i < len; i++) {
|
||||
|
@ -195,7 +195,7 @@ export function setTokensProvider(languageId: string, provider: TokensProvider):
|
|||
if (!languageIdentifier) {
|
||||
throw new Error(`Cannot set tokens provider for unknown language ${languageId}`);
|
||||
}
|
||||
let adapter = new TokenizationSupport2Adapter(StaticServices.standaloneColorService.get(), languageIdentifier, provider);
|
||||
let adapter = new TokenizationSupport2Adapter(StaticServices.standaloneThemeService.get(), languageIdentifier, provider);
|
||||
return modes.TokenizationRegistry.register(languageId, adapter);
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ export function setTokensProvider(languageId: string, provider: TokensProvider):
|
|||
*/
|
||||
export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage): IDisposable {
|
||||
let lexer = compile(languageId, languageDef);
|
||||
let adapter = createTokenizationSupport(StaticServices.modeService.get(), StaticServices.standaloneColorService.get(), languageId, lexer);
|
||||
let adapter = createTokenizationSupport(StaticServices.modeService.get(), StaticServices.standaloneThemeService.get(), languageId, lexer);
|
||||
return modes.TokenizationRegistry.register(languageId, adapter);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ import {
|
|||
} from 'vs/editor/browser/standalone/simpleServices';
|
||||
import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService';
|
||||
import { IMenuService } from 'vs/platform/actions/common/actions';
|
||||
import { IStandaloneColorService } from 'vs/editor/common/services/standaloneColorService';
|
||||
import { StandaloneColorServiceImpl } from 'vs/editor/browser/services/standaloneColorServiceImpl';
|
||||
import { IStandaloneThemeService } from 'vs/editor/common/services/standaloneThemeService';
|
||||
import { StandaloneThemeServiceImpl } from 'vs/editor/browser/services/standaloneThemeServiceImpl';
|
||||
|
||||
export interface IEditorContextViewService extends IContextViewService {
|
||||
dispose(): void;
|
||||
|
@ -139,7 +139,7 @@ export module StaticServices {
|
|||
|
||||
export const storageService = define(IStorageService, () => NullStorageService);
|
||||
|
||||
export const standaloneColorService = define(IStandaloneColorService, () => new StandaloneColorServiceImpl());
|
||||
export const standaloneThemeService = define(IStandaloneThemeService, () => new StandaloneThemeServiceImpl());
|
||||
}
|
||||
|
||||
export class DynamicStandaloneServices extends Disposable {
|
||||
|
|
|
@ -15,7 +15,7 @@ import * as monarchCommon from 'vs/editor/common/modes/monarch/monarchCommon';
|
|||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { Token, TokenizationResult, TokenizationResult2 } from 'vs/editor/common/core/token';
|
||||
import { NULL_STATE, NULL_MODE_ID } from 'vs/editor/common/modes/nullMode';
|
||||
import { IStandaloneColorService } from 'vs/editor/common/services/standaloneColorService';
|
||||
import { IStandaloneThemeService } from 'vs/editor/common/services/standaloneThemeService';
|
||||
import { TokenTheme } from 'vs/editor/common/modes/supports/tokenization';
|
||||
|
||||
const CACHE_STACK_DEPTH = 5;
|
||||
|
@ -378,15 +378,15 @@ class MonarchModernTokensCollector implements IMonarchTokensCollector {
|
|||
export class MonarchTokenizer implements modes.ITokenizationSupport {
|
||||
|
||||
private readonly _modeService: IModeService;
|
||||
private readonly _standaloneColorService: IStandaloneColorService;
|
||||
private readonly _standaloneThemeService: IStandaloneThemeService;
|
||||
private readonly _modeId: string;
|
||||
private readonly _lexer: monarchCommon.ILexer;
|
||||
private _embeddedModes: { [modeId: string]: boolean; };
|
||||
private _tokenizationRegistryListener: IDisposable;
|
||||
|
||||
constructor(modeService: IModeService, standaloneColorService: IStandaloneColorService, modeId: string, lexer: monarchCommon.ILexer) {
|
||||
constructor(modeService: IModeService, standaloneThemeService: IStandaloneThemeService, modeId: string, lexer: monarchCommon.ILexer) {
|
||||
this._modeService = modeService;
|
||||
this._standaloneColorService = standaloneColorService;
|
||||
this._standaloneThemeService = standaloneThemeService;
|
||||
this._modeId = modeId;
|
||||
this._lexer = lexer;
|
||||
this._embeddedModes = Object.create(null);
|
||||
|
@ -429,7 +429,7 @@ export class MonarchTokenizer implements modes.ITokenizationSupport {
|
|||
}
|
||||
|
||||
public tokenize2(line: string, lineState: modes.IState, offsetDelta: number): TokenizationResult2 {
|
||||
let tokensCollector = new MonarchModernTokensCollector(this._modeService, this._standaloneColorService.getTheme().tokenTheme);
|
||||
let tokensCollector = new MonarchModernTokensCollector(this._modeService, this._standaloneThemeService.getTheme().tokenTheme);
|
||||
let endLineState = this._tokenize(line, <MonarchLineState>lineState, offsetDelta, tokensCollector);
|
||||
return tokensCollector.finalize(endLineState);
|
||||
}
|
||||
|
@ -836,6 +836,6 @@ function findBracket(lexer: monarchCommon.ILexer, matched: string) {
|
|||
return null;
|
||||
}
|
||||
|
||||
export function createTokenizationSupport(modeService: IModeService, standaloneColorService: IStandaloneColorService, modeId: string, lexer: monarchCommon.ILexer): modes.ITokenizationSupport {
|
||||
return new MonarchTokenizer(modeService, standaloneColorService, modeId, lexer);
|
||||
export function createTokenizationSupport(modeService: IModeService, standaloneThemeService: IStandaloneThemeService, modeId: string, lexer: monarchCommon.ILexer): modes.ITokenizationSupport {
|
||||
return new MonarchTokenizer(modeService, standaloneThemeService, modeId, lexer);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { TokenTheme, ITokenThemeRule } from 'vs/editor/common/modes/supports/tokenization';
|
||||
import { ITheme } from "vs/platform/theme/common/themeService";
|
||||
import { ITheme, IThemeService } from "vs/platform/theme/common/themeService";
|
||||
|
||||
export var IStandaloneColorService = createDecorator<IStandaloneColorService>('standaloneColorService');
|
||||
export var IStandaloneThemeService = createDecorator<IStandaloneThemeService>('themeService');
|
||||
|
||||
export type BuiltinTheme = 'vs' | 'vs-dark' | 'hc-black';
|
||||
export type IColors = { [colorId: string]: string; };
|
||||
|
@ -24,7 +24,7 @@ export interface IStandaloneTheme extends ITheme {
|
|||
tokenTheme: TokenTheme;
|
||||
}
|
||||
|
||||
export interface IStandaloneColorService {
|
||||
export interface IStandaloneThemeService extends IThemeService {
|
||||
_serviceBrand: any;
|
||||
|
||||
setTheme(themeName: string): string;
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import { IStandaloneThemeData } from "vs/editor/common/services/standaloneColorService";
|
||||
import { IStandaloneThemeData } from "vs/editor/common/services/standaloneThemeService";
|
||||
|
||||
/* -------------------------------- Begin vs theme -------------------------------- */
|
||||
export const vs: IStandaloneThemeData = {
|
||||
|
@ -68,7 +68,7 @@ export const vs: IStandaloneThemeData = {
|
|||
{ token: 'predefined.sql', foreground: 'FF00FF' },
|
||||
],
|
||||
colors: {
|
||||
editorBackground: '#FFFFFF',
|
||||
editorBackground: '#FFFFFE',
|
||||
editorForeground: '#000000',
|
||||
editorInactiveSelection: '#E5EBF1',
|
||||
editorGuide: '#D3D3D3',
|
||||
|
|
|
@ -17,7 +17,7 @@ import { IModeService } from 'vs/editor/common/services/modeService';
|
|||
import { TokenMetadata } from 'vs/editor/common/model/tokensBinaryEncoding';
|
||||
import { TokenizationRegistry, LanguageIdentifier, FontStyle, StandardTokenType, ITokenizationSupport, IState } from 'vs/editor/common/modes';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import { IStandaloneColorService } from 'vs/editor/common/services/standaloneColorService';
|
||||
import { IStandaloneThemeService } from 'vs/editor/common/services/standaloneThemeService';
|
||||
import { NULL_STATE, nullTokenize, nullTokenize2 } from 'vs/editor/common/modes/nullMode';
|
||||
import { Token } from 'vs/editor/common/core/token';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
|
@ -32,18 +32,18 @@ class InspectTokensController extends Disposable implements IEditorContribution
|
|||
}
|
||||
|
||||
private _editor: ICodeEditor;
|
||||
private _standaloneColorService: IStandaloneColorService;
|
||||
private _standaloneThemeService: IStandaloneThemeService;
|
||||
private _modeService: IModeService;
|
||||
private _widget: InspectTokensWidget;
|
||||
|
||||
constructor(
|
||||
editor: ICodeEditor,
|
||||
@IStandaloneColorService standaloneColorService: IStandaloneColorService,
|
||||
@IStandaloneThemeService standaloneColorService: IStandaloneThemeService,
|
||||
@IModeService modeService: IModeService
|
||||
) {
|
||||
super();
|
||||
this._editor = editor;
|
||||
this._standaloneColorService = standaloneColorService;
|
||||
this._standaloneThemeService = standaloneColorService;
|
||||
this._modeService = modeService;
|
||||
this._widget = null;
|
||||
|
||||
|
@ -68,7 +68,7 @@ class InspectTokensController extends Disposable implements IEditorContribution
|
|||
if (!this._editor.getModel()) {
|
||||
return;
|
||||
}
|
||||
this._widget = new InspectTokensWidget(this._editor, this._standaloneColorService, this._modeService);
|
||||
this._widget = new InspectTokensWidget(this._editor, this._standaloneThemeService, this._modeService);
|
||||
}
|
||||
|
||||
public stop(): void {
|
||||
|
@ -166,7 +166,7 @@ class InspectTokensWidget extends Disposable implements IContentWidget {
|
|||
public allowEditorOverflow = true;
|
||||
|
||||
private _editor: ICodeEditor;
|
||||
private _standaloneColorService: IStandaloneColorService;
|
||||
private _standaloneThemeService: IStandaloneThemeService;
|
||||
private _modeService: IModeService;
|
||||
private _tokenizationSupport: ITokenizationSupport;
|
||||
private _model: IModel;
|
||||
|
@ -174,12 +174,12 @@ class InspectTokensWidget extends Disposable implements IContentWidget {
|
|||
|
||||
constructor(
|
||||
editor: ICodeEditor,
|
||||
standaloneColorService: IStandaloneColorService,
|
||||
standaloneThemeService: IStandaloneThemeService,
|
||||
modeService: IModeService
|
||||
) {
|
||||
super();
|
||||
this._editor = editor;
|
||||
this._standaloneColorService = standaloneColorService;
|
||||
this._standaloneThemeService = standaloneThemeService;
|
||||
this._modeService = modeService;
|
||||
this._model = this._editor.getModel();
|
||||
this._domNode = document.createElement('div');
|
||||
|
|
Loading…
Reference in New Issue