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