Skip to content

Commit 40bee4a

Browse files
committed
use status octicons
1 parent baab2e6 commit 40bee4a

19 files changed

Lines changed: 121 additions & 72 deletions
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import { Disposable } from 'vs/base/common/lifecycle';
7+
import Severity from 'vs/base/common/severity';
8+
import * as DOM from 'vs/base/browser/dom';
9+
import { Color } from 'vs/base/common/color';
10+
11+
export class SeverityIcon extends Disposable {
12+
13+
readonly element: HTMLElement;
14+
15+
constructor() {
16+
super();
17+
this.element = DOM.$('');
18+
}
19+
20+
set severity(severity: Severity) {
21+
this.element.className = this.iconClassNameFor(severity);
22+
}
23+
24+
style({ color }: {
25+
color: Color
26+
}): void {
27+
this.element.style.color = color.toString();
28+
}
29+
30+
private iconClassNameFor(severity: Severity): string {
31+
switch (severity) {
32+
case Severity.Ignore:
33+
return 'octicon octicon-info';
34+
case Severity.Info:
35+
return 'octicon octicon-info';
36+
case Severity.Warning:
37+
return 'octicon octicon-warning';
38+
case Severity.Error:
39+
return 'octicon octicon-error';
40+
}
41+
return '';
42+
}
43+
44+
}

src/vs/editor/contrib/gotoError/gotoErrorWidget.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { IMarker, MarkerSeverity, IRelatedInformation } from 'vs/platform/marker
1111
import { Position } from 'vs/editor/common/core/position';
1212
import { Range } from 'vs/editor/common/core/range';
1313
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
14-
import { registerColor, oneOf, textLinkForeground } from 'vs/platform/theme/common/colorRegistry';
14+
import { registerColor, oneOf, textLinkForeground, severityIconErrorForeground, severityIconWarningForeground, severityIconInfoForeground } from 'vs/platform/theme/common/colorRegistry';
1515
import { IThemeService, ITheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
1616
import { Color } from 'vs/base/common/color';
1717
import { editorErrorForeground, editorErrorBorder, editorWarningForeground, editorWarningBorder, editorInfoForeground, editorInfoBorder } from 'vs/editor/common/view/editorColorRegistry';
@@ -321,9 +321,9 @@ export class MarkerNavigationWidget extends PeekViewWidget {
321321

322322
// theming
323323

324-
let errorDefault = oneOf(editorErrorForeground, editorErrorBorder);
325-
let warningDefault = oneOf(editorWarningForeground, editorWarningBorder);
326-
let infoDefault = oneOf(editorInfoForeground, editorInfoBorder);
324+
let errorDefault = oneOf(severityIconErrorForeground, editorErrorForeground, editorErrorBorder);
325+
let warningDefault = oneOf(severityIconWarningForeground, editorWarningForeground, editorWarningBorder);
326+
let infoDefault = oneOf(severityIconInfoForeground, editorInfoForeground, editorInfoBorder);
327327

328328
export const editorMarkerNavigationError = registerColor('editorMarkerNavigationError.background', { dark: errorDefault, light: errorDefault, hc: errorDefault }, nls.localize('editorMarkerNavigationError', 'Editor marker navigation widget error color.'));
329329
export const editorMarkerNavigationWarning = registerColor('editorMarkerNavigationWarning.background', { dark: warningDefault, light: warningDefault, hc: warningDefault }, nls.localize('editorMarkerNavigationWarning', 'Editor marker navigation widget warning color.'));

src/vs/editor/contrib/gotoError/media/status-error-inverse.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/vs/editor/contrib/gotoError/media/status-error.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/vs/editor/contrib/gotoError/media/status-info-inverse.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/vs/editor/contrib/gotoError/media/status-info.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/vs/editor/contrib/gotoError/media/status-warning-inverse.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/vs/editor/contrib/gotoError/media/status-warning.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/vs/platform/markers/common/markers.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ export namespace MarkerSeverity {
7171
case Severity.Ignore: return MarkerSeverity.Hint;
7272
}
7373
}
74+
75+
export function toSeverity(severity: MarkerSeverity): Severity {
76+
switch (severity) {
77+
case MarkerSeverity.Error: return Severity.Error;
78+
case MarkerSeverity.Warning: return Severity.Warning;
79+
case MarkerSeverity.Info: return Severity.Info;
80+
case MarkerSeverity.Hint: return Severity.Ignore;
81+
}
82+
}
7483
}
7584

7685
/**

src/vs/platform/theme/common/colorRegistry.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,11 @@ export const menuSelectionBackground = registerColor('menu.selectionBackground',
264264
export const menuSelectionBorder = registerColor('menu.selectionBorder', { dark: null, light: null, hc: activeContrastBorder }, nls.localize('menuSelectionBorder', "Border color of the selected menu item in menus."));
265265
export const menuSeparatorBackground = registerColor('menu.separatorBackground', { dark: '#BBBBBB', light: '#888888', hc: contrastBorder }, nls.localize('menuSeparatorBackground', "Color of a separator menu item in menus."));
266266

267+
export const severityIconErrorForeground = registerColor('severity.errorForeground', { dark: '#ea4646', light: '#d60a0a', hc: null }, nls.localize('severity.errorForeground', 'Foreground color of error icon.'));
268+
export const severityIconWarningForeground = registerColor('severity.warningForeground', { dark: '#FFCC00', light: '#E9A700', hc: null }, nls.localize('severity.warningForeground', 'Foreground color of warning icon.'));
269+
export const severityIconInfoForeground = registerColor('severity.infoForeground', { dark: '#008000', light: '#008000', hc: null }, nls.localize('severity.infoForeground', 'Foreground color of info icon.'));
270+
export const severityIconIgnoreForeground = registerColor('severity.ignoreForeground', { dark: Color.fromHex('#eeeeee').transparent(0.7), light: '#6c6c6c', hc: null }, nls.localize('severity.ignoreForeground', 'Foreground color of ignore icon.'));
271+
267272
/**
268273
* Editor background color.
269274
* Because of bug https://monacotools.visualstudio.com/DefaultCollection/Monaco/_workitems/edit/13254

0 commit comments

Comments
 (0)