From 1a512160174d6d3009ed1fff324994bbf1f635d5 Mon Sep 17 00:00:00 2001 From: Oleksii Orel Date: Thu, 31 May 2018 20:23:04 +0300 Subject: [PATCH] code cleanup Signed-off-by: Oleksii Orel --- .../src/plugin/status-bar/status-bar-item.ts | 20 +++++++------------ .../src/plugin/status-bar/vscolor-const.ts | 12 +++++++++++ 2 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 packages/plugin-ext/src/plugin/status-bar/vscolor-const.ts diff --git a/packages/plugin-ext/src/plugin/status-bar/status-bar-item.ts b/packages/plugin-ext/src/plugin/status-bar/status-bar-item.ts index 8f5f580ddadae..d68b4aca7285d 100644 --- a/packages/plugin-ext/src/plugin/status-bar/status-bar-item.ts +++ b/packages/plugin-ext/src/plugin/status-bar/status-bar-item.ts @@ -4,11 +4,12 @@ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 */ -import {StatusBarItem} from '@theia/plugin'; +import * as theia from '@theia/plugin'; import {ThemeColor, StatusBarAlignment} from '../types-impl'; -import {StatusBarMessageRegistryMain} from "../../api/plugin-api"; +import {StatusBarMessageRegistryMain} from '../../api/plugin-api'; +import {VS_COLORS} from './vscolor-const'; -export class StatusBarItemImpl implements StatusBarItem { +export class StatusBarItemImpl implements theia.StatusBarItem { private _messageId: string; private _alignment: StatusBarAlignment; private _priority: number; @@ -31,8 +32,8 @@ export class StatusBarItemImpl implements StatusBarItem { this._priority = priority; } - public get alignment(): StatusBarAlignment { - return this._alignment; + public get alignment(): theia.StatusBarAlignment { + return this._alignment; } public get priority(): number { @@ -122,14 +123,7 @@ export class StatusBarItemImpl implements StatusBarItem { private getColor(): string | undefined { if (typeof this.color !== 'string') { const colorId = (this.color).id; - // TODO implement ThemeColor for vs (redo it) - const vsColorMap: Map = new Map([ - ['statusBar.foreground', '--theia-layout-color4'], - ['editorOverviewRuler.errorForeground', '--theia-error-color0'], - ['editorOverviewRuler.warningForeground', '--theia-warn-color0'], - ['editorOverviewRuler.infoForeground', '--theia-info-color0'], - ]); - return `var(${vsColorMap.has(colorId) ? vsColorMap.get(colorId) : colorId})`; + return `var(${VS_COLORS[colorId] ? VS_COLORS[colorId] : colorId})`; } return this.color; } diff --git a/packages/plugin-ext/src/plugin/status-bar/vscolor-const.ts b/packages/plugin-ext/src/plugin/status-bar/vscolor-const.ts new file mode 100644 index 0000000000000..1d5cd4e1a9438 --- /dev/null +++ b/packages/plugin-ext/src/plugin/status-bar/vscolor-const.ts @@ -0,0 +1,12 @@ +/* + * Copyright (C) 2018 Red Hat, Inc. and others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + */ +export const VS_COLORS: {[vsColorId: string]: string} = { + 'statusBar.foreground': '--theia-layout-color4', + 'editorOverviewRuler.errorForeground': '--theia-error-color0', + 'editorOverviewRuler.warningForeground': '--theia-warn-color0', + 'editorOverviewRuler.infoForeground': '--theia-info-color0' +};