提交 9b45cbe5 编写于 作者: M Matt Bierner

Trying to get rid of some cases where we use types of `T | null | undefined` in findWidget

上级 539c6cc4
......@@ -32,7 +32,7 @@ export interface IFindInputOptions extends IFindInputStyles {
}
export interface IFindInputStyles extends IInputBoxStyles {
inputActiveOptionBorder?: Color | null;
inputActiveOptionBorder?: Color;
}
const NLS_DEFAULT_LABEL = nls.localize('defaultLabel', "input");
......@@ -48,20 +48,20 @@ export class FindInput extends Widget {
private label: string;
private fixFocusOnOptionClickEnabled = true;
private inputActiveOptionBorder?: Color | null;
private inputBackground?: Color | null;
private inputForeground?: Color | null;
private inputBorder?: Color | null;
private inputValidationInfoBorder?: Color | null;
private inputValidationInfoBackground?: Color | null;
private inputValidationInfoForeground?: Color | null;
private inputValidationWarningBorder?: Color | null;
private inputValidationWarningBackground?: Color | null;
private inputValidationWarningForeground?: Color | null;
private inputValidationErrorBorder?: Color | null;
private inputValidationErrorBackground?: Color | null;
private inputValidationErrorForeground?: Color | null;
private inputActiveOptionBorder?: Color;
private inputBackground?: Color;
private inputForeground?: Color;
private inputBorder?: Color;
private inputValidationInfoBorder?: Color;
private inputValidationInfoBackground?: Color;
private inputValidationInfoForeground?: Color;
private inputValidationWarningBorder?: Color;
private inputValidationWarningBackground?: Color;
private inputValidationWarningForeground?: Color;
private inputValidationErrorBorder?: Color;
private inputValidationErrorBackground?: Color;
private inputValidationErrorForeground?: Color;
private regex: RegexCheckbox;
private wholeWords: WholeWordsCheckbox;
......@@ -202,7 +202,7 @@ export class FindInput extends Widget {
protected applyStyles(): void {
if (this.domNode) {
const checkBoxStyles: ICheckboxStyles = {
inputActiveOptionBorder: this.inputActiveOptionBorder || undefined,
inputActiveOptionBorder: this.inputActiveOptionBorder,
};
this.regex.style(checkBoxStyles);
this.wholeWords.style(checkBoxStyles);
......@@ -313,7 +313,7 @@ export class FindInput extends Widget {
this.regex = this._register(new RegexCheckbox({
appendTitle: appendRegexLabel,
isChecked: false,
inputActiveOptionBorder: this.inputActiveOptionBorder || undefined
inputActiveOptionBorder: this.inputActiveOptionBorder
}));
this._register(this.regex.onChange(viaKeyboard => {
this._onDidOptionChange.fire(viaKeyboard);
......@@ -330,7 +330,7 @@ export class FindInput extends Widget {
this.wholeWords = this._register(new WholeWordsCheckbox({
appendTitle: appendWholeWordsLabel,
isChecked: false,
inputActiveOptionBorder: this.inputActiveOptionBorder || undefined
inputActiveOptionBorder: this.inputActiveOptionBorder
}));
this._register(this.wholeWords.onChange(viaKeyboard => {
this._onDidOptionChange.fire(viaKeyboard);
......@@ -344,7 +344,7 @@ export class FindInput extends Widget {
this.caseSensitive = this._register(new CaseSensitiveCheckbox({
appendTitle: appendCaseSensitiveLabel,
isChecked: false,
inputActiveOptionBorder: this.inputActiveOptionBorder || undefined
inputActiveOptionBorder: this.inputActiveOptionBorder
}));
this._register(this.caseSensitive.onChange(viaKeyboard => {
this._onDidOptionChange.fire(viaKeyboard);
......
......@@ -32,18 +32,18 @@ export interface IInputOptions extends IInputBoxStyles {
}
export interface IInputBoxStyles {
readonly inputBackground?: Color | null;
readonly inputForeground?: Color | null;
readonly inputBorder?: Color | null;
readonly inputValidationInfoBorder?: Color | null;
readonly inputValidationInfoBackground?: Color | null;
readonly inputValidationInfoForeground?: Color | null;
readonly inputValidationWarningBorder?: Color | null;
readonly inputValidationWarningBackground?: Color | null;
readonly inputValidationWarningForeground?: Color | null;
readonly inputValidationErrorBorder?: Color | null;
readonly inputValidationErrorBackground?: Color | null;
readonly inputValidationErrorForeground?: Color | null;
readonly inputBackground?: Color;
readonly inputForeground?: Color;
readonly inputBorder?: Color;
readonly inputValidationInfoBorder?: Color;
readonly inputValidationInfoBackground?: Color;
readonly inputValidationInfoForeground?: Color;
readonly inputValidationWarningBorder?: Color;
readonly inputValidationWarningBackground?: Color;
readonly inputValidationWarningForeground?: Color;
readonly inputValidationErrorBorder?: Color;
readonly inputValidationErrorBackground?: Color;
readonly inputValidationErrorForeground?: Color;
}
export interface IInputValidator {
......@@ -96,19 +96,19 @@ export class InputBox extends Widget {
private state: string | null = 'idle';
private cachedHeight: number | null;
private inputBackground?: Color | null;
private inputForeground?: Color | null;
private inputBorder?: Color | null;
private inputValidationInfoBorder?: Color | null;
private inputValidationInfoBackground?: Color | null;
private inputValidationInfoForeground?: Color | null;
private inputValidationWarningBorder?: Color | null;
private inputValidationWarningBackground?: Color | null;
private inputValidationWarningForeground?: Color | null;
private inputValidationErrorBorder?: Color | null;
private inputValidationErrorBackground?: Color | null;
private inputValidationErrorForeground?: Color | null;
private inputBackground?: Color;
private inputForeground?: Color;
private inputBorder?: Color;
private inputValidationInfoBorder?: Color;
private inputValidationInfoBackground?: Color;
private inputValidationInfoForeground?: Color;
private inputValidationWarningBorder?: Color;
private inputValidationWarningBackground?: Color;
private inputValidationWarningForeground?: Color;
private inputValidationErrorBorder?: Color;
private inputValidationErrorBackground?: Color;
private inputValidationErrorForeground?: Color;
private _onDidChange = this._register(new Emitter<string>());
public readonly onDidChange: Event<string> = this._onDidChange.event;
......
......@@ -530,19 +530,19 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
private _applyTheme(theme: ITheme) {
let inputStyles: IFindInputStyles = {
inputActiveOptionBorder: theme.getColor(inputActiveOptionBorder),
inputBackground: theme.getColor(inputBackground),
inputForeground: theme.getColor(inputForeground),
inputBorder: theme.getColor(inputBorder),
inputValidationInfoBackground: theme.getColor(inputValidationInfoBackground),
inputValidationInfoForeground: theme.getColor(inputValidationInfoForeground),
inputValidationInfoBorder: theme.getColor(inputValidationInfoBorder),
inputValidationWarningBackground: theme.getColor(inputValidationWarningBackground),
inputValidationWarningForeground: theme.getColor(inputValidationWarningForeground),
inputValidationWarningBorder: theme.getColor(inputValidationWarningBorder),
inputValidationErrorBackground: theme.getColor(inputValidationErrorBackground),
inputValidationErrorForeground: theme.getColor(inputValidationErrorForeground),
inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder)
inputActiveOptionBorder: theme.getColor(inputActiveOptionBorder) || undefined,
inputBackground: theme.getColor(inputBackground) || undefined,
inputForeground: theme.getColor(inputForeground) || undefined,
inputBorder: theme.getColor(inputBorder) || undefined,
inputValidationInfoBackground: theme.getColor(inputValidationInfoBackground) || undefined,
inputValidationInfoForeground: theme.getColor(inputValidationInfoForeground) || undefined,
inputValidationInfoBorder: theme.getColor(inputValidationInfoBorder) || undefined,
inputValidationWarningBackground: theme.getColor(inputValidationWarningBackground) || undefined,
inputValidationWarningForeground: theme.getColor(inputValidationWarningForeground) || undefined,
inputValidationWarningBorder: theme.getColor(inputValidationWarningBorder) || undefined,
inputValidationErrorBackground: theme.getColor(inputValidationErrorBackground) || undefined,
inputValidationErrorForeground: theme.getColor(inputValidationErrorForeground) || undefined,
inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder) || undefined,
};
this._findInput.style(inputStyles);
this._replaceInputBox.style(inputStyles);
......
......@@ -6,7 +6,7 @@
import 'vs/css!./simpleFindWidget';
import * as nls from 'vs/nls';
import * as dom from 'vs/base/browser/dom';
import { FindInput } from 'vs/base/browser/ui/findinput/findInput';
import { FindInput, IFindInputStyles } from 'vs/base/browser/ui/findinput/findInput';
import { Widget } from 'vs/base/browser/ui/widget';
import { Delayer } from 'vs/base/common/async';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
......@@ -159,20 +159,20 @@ export abstract class SimpleFindWidget extends Widget {
}
public updateTheme(theme: ITheme): void {
const inputStyles = {
inputActiveOptionBorder: theme.getColor(inputActiveOptionBorder),
inputBackground: theme.getColor(inputBackground),
inputForeground: theme.getColor(inputForeground),
inputBorder: theme.getColor(inputBorder),
inputValidationInfoBackground: theme.getColor(inputValidationInfoBackground),
inputValidationInfoForeground: theme.getColor(inputValidationInfoForeground),
inputValidationInfoBorder: theme.getColor(inputValidationInfoBorder),
inputValidationWarningBackground: theme.getColor(inputValidationWarningBackground),
inputValidationWarningForeground: theme.getColor(inputValidationWarningForeground),
inputValidationWarningBorder: theme.getColor(inputValidationWarningBorder),
inputValidationErrorBackground: theme.getColor(inputValidationErrorBackground),
inputValidationErrorForeground: theme.getColor(inputValidationErrorForeground),
inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder)
const inputStyles: IFindInputStyles = {
inputActiveOptionBorder: theme.getColor(inputActiveOptionBorder) || undefined,
inputBackground: theme.getColor(inputBackground) || undefined,
inputForeground: theme.getColor(inputForeground) || undefined,
inputBorder: theme.getColor(inputBorder) || undefined,
inputValidationInfoBackground: theme.getColor(inputValidationInfoBackground) || undefined,
inputValidationInfoForeground: theme.getColor(inputValidationInfoForeground) || undefined,
inputValidationInfoBorder: theme.getColor(inputValidationInfoBorder) || undefined,
inputValidationWarningBackground: theme.getColor(inputValidationWarningBackground) || undefined,
inputValidationWarningForeground: theme.getColor(inputValidationWarningForeground) || undefined,
inputValidationWarningBorder: theme.getColor(inputValidationWarningBorder) || undefined,
inputValidationErrorBackground: theme.getColor(inputValidationErrorBackground) || undefined,
inputValidationErrorForeground: theme.getColor(inputValidationErrorForeground) || undefined,
inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder) || undefined
};
this._findInput.style(inputStyles);
}
......
......@@ -165,7 +165,7 @@ export class MarkerNavigationWidget extends ZoneWidget {
private _message: MessageWidget;
private _callOnDispose: IDisposable[] = [];
private _severity: MarkerSeverity;
private _backgroundColor: Color | null;
private _backgroundColor?: Color;
private _onDidSelectRelatedInformation = new Emitter<IRelatedInformation>();
readonly onDidSelectRelatedInformation: Event<IRelatedInformation> = this._onDidSelectRelatedInformation.event;
......@@ -185,7 +185,7 @@ export class MarkerNavigationWidget extends ZoneWidget {
}
private _applyTheme(theme: ITheme) {
this._backgroundColor = theme.getColor(editorMarkerNavigationBackground);
this._backgroundColor = theme.getColor(editorMarkerNavigationBackground) || undefined;
let colorId = editorMarkerNavigationError;
if (this._severity === MarkerSeverity.Warning) {
colorId = editorMarkerNavigationWarning;
......
......@@ -34,9 +34,9 @@ export function getOuterEditor(accessor: ServicesAccessor): ICodeEditor | null {
}
export interface IPeekViewStyles extends IStyles {
headerBackgroundColor?: Color | null;
primaryHeadingColor?: Color | null;
secondaryHeadingColor?: Color | null;
headerBackgroundColor?: Color;
primaryHeadingColor?: Color;
secondaryHeadingColor?: Color;
}
export type IPeekViewOptions = IOptions & IPeekViewStyles;
......
......@@ -279,8 +279,8 @@ export class ReferenceWidget extends PeekViewWidget {
arrowColor: borderColor,
frameColor: borderColor,
headerBackgroundColor: theme.getColor(peekViewTitleBackground) || Color.transparent,
primaryHeadingColor: theme.getColor(peekViewTitleForeground),
secondaryHeadingColor: theme.getColor(peekViewTitleInfoForeground)
primaryHeadingColor: theme.getColor(peekViewTitleForeground) || undefined,
secondaryHeadingColor: theme.getColor(peekViewTitleInfoForeground) || undefined
});
}
......
......@@ -132,9 +132,9 @@ class ColorRegistry implements IColorRegistry {
}
public resolveDefaultColor(id: ColorIdentifier, theme: ITheme): Color | null {
let colorDesc = this.colorsById[id];
const colorDesc = this.colorsById[id];
if (colorDesc && colorDesc.defaults) {
let colorValue = colorDesc.defaults[theme.type];
const colorValue = colorDesc.defaults[theme.type];
return resolveColorValue(colorValue, theme);
}
return null;
......
......@@ -100,18 +100,18 @@ export class QuickInputBox {
style(theme: ITheme) {
this.inputBox.style({
inputForeground: theme.getColor(inputForeground),
inputBackground: theme.getColor(inputBackground),
inputBorder: theme.getColor(inputBorder),
inputValidationInfoBackground: theme.getColor(inputValidationInfoBackground),
inputValidationInfoForeground: theme.getColor(inputValidationInfoForeground),
inputValidationInfoBorder: theme.getColor(inputValidationInfoBorder),
inputValidationWarningBackground: theme.getColor(inputValidationWarningBackground),
inputValidationWarningForeground: theme.getColor(inputValidationWarningForeground),
inputValidationWarningBorder: theme.getColor(inputValidationWarningBorder),
inputValidationErrorBackground: theme.getColor(inputValidationErrorBackground),
inputValidationErrorForeground: theme.getColor(inputValidationErrorForeground),
inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder),
inputForeground: theme.getColor(inputForeground) || undefined,
inputBackground: theme.getColor(inputBackground) || undefined,
inputBorder: theme.getColor(inputBorder) || undefined,
inputValidationInfoBackground: theme.getColor(inputValidationInfoBackground) || undefined,
inputValidationInfoForeground: theme.getColor(inputValidationInfoForeground) || undefined,
inputValidationInfoBorder: theme.getColor(inputValidationInfoBorder) || undefined,
inputValidationWarningBackground: theme.getColor(inputValidationWarningBackground) || undefined,
inputValidationWarningForeground: theme.getColor(inputValidationWarningForeground) || undefined,
inputValidationWarningBorder: theme.getColor(inputValidationWarningBorder) || undefined,
inputValidationErrorBackground: theme.getColor(inputValidationErrorBackground) || undefined,
inputValidationErrorForeground: theme.getColor(inputValidationErrorForeground) || undefined,
inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder) || undefined,
});
}
......
......@@ -365,8 +365,8 @@ class DirtyDiffWidget extends PeekViewWidget {
arrowColor: borderColor,
frameColor: borderColor,
headerBackgroundColor: theme.getColor(peekViewTitleBackground) || Color.transparent,
primaryHeadingColor: theme.getColor(peekViewTitleForeground),
secondaryHeadingColor: theme.getColor(peekViewTitleInfoForeground)
primaryHeadingColor: theme.getColor(peekViewTitleForeground) || undefined,
secondaryHeadingColor: theme.getColor(peekViewTitleInfoForeground) || undefined
});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册