提交 8021f0f4 编写于 作者: A Alex Dima

Simplify usage of IModelDecorationOverviewRulerOptions

上级 eb4161ee
......@@ -40,12 +40,7 @@ export interface IModelDecorationOverviewRulerOptions {
* CSS color to render in the overview ruler.
* e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
*/
darkColor: string | ThemeColor;
/**
* CSS color to render in the overview ruler.
* e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
*/
hcColor?: string | ThemeColor;
darkColor?: string | ThemeColor;
/**
* The position in the overview ruler.
*/
......
......@@ -2783,30 +2783,28 @@ function cleanClassName(className: string): string {
export class ModelDecorationOverviewRulerOptions implements model.IModelDecorationOverviewRulerOptions {
readonly color: string | ThemeColor;
readonly darkColor: string | ThemeColor;
readonly hcColor: string | ThemeColor;
readonly position: model.OverviewRulerLane;
_resolvedColor: string;
constructor(options: model.IModelDecorationOverviewRulerOptions) {
this.color = strings.empty;
this.darkColor = strings.empty;
this.hcColor = strings.empty;
this.position = model.OverviewRulerLane.Center;
this._resolvedColor = null;
if (options && options.color) {
this.color = options.color;
if (typeof options.color !== 'string') {
this.darkColor = options.color;
}
}
if (options && options.darkColor) {
this.darkColor = options.darkColor;
this.hcColor = options.darkColor;
}
if (options && options.hcColor) {
this.hcColor = options.hcColor;
}
if (options && options.hasOwnProperty('position')) {
if (options && typeof options.position === 'number') {
this.position = options.position;
}
// console.log(this);
}
}
......
......@@ -129,7 +129,6 @@ class ModelMarkerHandler {
let className: string;
let color: ThemeColor;
let darkColor: ThemeColor;
let zIndex: number;
let inlineClassName: string;
......@@ -145,20 +144,17 @@ class ModelMarkerHandler {
case MarkerSeverity.Warning:
className = ClassName.EditorWarningDecoration;
color = themeColorFromId(overviewRulerWarning);
darkColor = themeColorFromId(overviewRulerWarning);
zIndex = 20;
break;
case MarkerSeverity.Info:
className = ClassName.EditorInfoDecoration;
color = themeColorFromId(overviewRulerInfo);
darkColor = themeColorFromId(overviewRulerInfo);
zIndex = 10;
break;
case MarkerSeverity.Error:
default:
className = ClassName.EditorErrorDecoration;
color = themeColorFromId(overviewRulerError);
darkColor = themeColorFromId(overviewRulerError);
zIndex = 30;
break;
}
......@@ -205,7 +201,6 @@ class ModelMarkerHandler {
showIfCollapsed: true,
overviewRuler: {
color,
darkColor,
position: OverviewRulerLane.Right
},
zIndex,
......
......@@ -1407,7 +1407,7 @@ class OverviewRulerDecorations {
function resolveColor(opts: ModelDecorationOverviewRulerOptions, theme: ITheme): string {
if (!opts._resolvedColor) {
const themeType = theme.type;
const color = (themeType === 'dark' ? opts.darkColor : themeType === 'light' ? opts.color : opts.hcColor);
const color = (themeType === 'light' ? opts.color : opts.darkColor);
opts._resolvedColor = resolveRulerColor(color, theme);
}
return opts._resolvedColor;
......
......@@ -234,7 +234,6 @@ export class BracketMatchingController extends Disposable implements editorCommo
className: 'bracket-match',
overviewRuler: {
color: themeColorFromId(overviewRulerBracketMatchForeground),
darkColor: themeColorFromId(overviewRulerBracketMatchForeground),
position: OverviewRulerLane.Center
}
});
......
......@@ -272,7 +272,6 @@ export class FindDecorations implements IDisposable {
showIfCollapsed: true,
overviewRuler: {
color: themeColorFromId(overviewRulerFindMatchForeground),
darkColor: themeColorFromId(overviewRulerFindMatchForeground),
position: OverviewRulerLane.Center
}
});
......@@ -283,7 +282,6 @@ export class FindDecorations implements IDisposable {
showIfCollapsed: true,
overviewRuler: {
color: themeColorFromId(overviewRulerFindMatchForeground),
darkColor: themeColorFromId(overviewRulerFindMatchForeground),
position: OverviewRulerLane.Center
}
});
......@@ -298,7 +296,6 @@ export class FindDecorations implements IDisposable {
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
overviewRuler: {
color: themeColorFromId(overviewRulerFindMatchForeground),
darkColor: themeColorFromId(overviewRulerFindMatchForeground),
position: OverviewRulerLane.Center
}
});
......
......@@ -897,7 +897,6 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut
className: 'selectionHighlight',
overviewRuler: {
color: themeColorFromId(overviewRulerSelectionHighlightForeground),
darkColor: themeColorFromId(overviewRulerSelectionHighlightForeground),
position: OverviewRulerLane.Center
}
});
......
......@@ -433,7 +433,6 @@ class WordHighlighter {
className: 'wordHighlightStrong',
overviewRuler: {
color: themeColorFromId(overviewRulerWordHighlightStrongForeground),
darkColor: themeColorFromId(overviewRulerWordHighlightStrongForeground),
position: OverviewRulerLane.Center
}
});
......@@ -443,7 +442,6 @@ class WordHighlighter {
className: 'selectionHighlight',
overviewRuler: {
color: themeColorFromId(overviewRulerSelectionHighlightForeground),
darkColor: themeColorFromId(overviewRulerSelectionHighlightForeground),
position: OverviewRulerLane.Center
}
});
......@@ -453,7 +451,6 @@ class WordHighlighter {
className: 'wordHighlight',
overviewRuler: {
color: themeColorFromId(overviewRulerWordHighlightForeground),
darkColor: themeColorFromId(overviewRulerWordHighlightForeground),
position: OverviewRulerLane.Center
}
});
......
......@@ -1187,12 +1187,7 @@ declare namespace monaco.editor {
* CSS color to render in the overview ruler.
* e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
*/
darkColor: string | ThemeColor;
/**
* CSS color to render in the overview ruler.
* e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
*/
hcColor?: string | ThemeColor;
darkColor?: string | ThemeColor;
/**
* The position in the overview ruler.
*/
......
......@@ -352,7 +352,6 @@ export class KeybindingEditorDecorationsRenderer extends Disposable {
hoverMessage: msg,
overviewRuler: {
color: overviewRulerColor,
darkColor: overviewRulerColor,
position: OverviewRulerLane.Right
}
}
......
......@@ -262,7 +262,6 @@ export class GotoLineHandler extends QuickOpenHandler {
options: {
overviewRuler: {
color: themeColorFromId(overviewRulerRangeHighlight),
darkColor: themeColorFromId(overviewRulerRangeHighlight),
position: OverviewRulerLane.Full
}
}
......
......@@ -531,7 +531,6 @@ export class GotoSymbolHandler extends QuickOpenHandler {
options: {
overviewRuler: {
color: themeColorFromId(overviewRulerRangeHighlight),
darkColor: themeColorFromId(overviewRulerRangeHighlight),
position: OverviewRulerLane.Full
}
}
......
......@@ -808,7 +808,6 @@ class DirtyDiffDecorator {
if (options.overview) {
decorationOptions.overviewRuler = {
color: themeColorFromId(foregroundColor),
darkColor: themeColorFromId(foregroundColor),
position: OverviewRulerLane.Left
};
}
......
......@@ -116,7 +116,6 @@ export class FileMatch extends Disposable {
className: 'currentFindMatch',
overviewRuler: {
color: themeColorFromId(overviewRulerFindMatchForeground),
darkColor: themeColorFromId(overviewRulerFindMatchForeground),
position: OverviewRulerLane.Center
}
});
......@@ -126,7 +125,6 @@ export class FileMatch extends Disposable {
className: 'findMatch',
overviewRuler: {
color: themeColorFromId(overviewRulerFindMatchForeground),
darkColor: themeColorFromId(overviewRulerFindMatchForeground),
position: OverviewRulerLane.Center
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册