Skip to content

Commit 9b45cbe

Browse files
committed
Trying to get rid of some cases where we use types of T | null | undefined in findWidget
1 parent 539c6cc commit 9b45cbe

10 files changed

Lines changed: 95 additions & 95 deletions

File tree

src/vs/base/browser/ui/findinput/findInput.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export interface IFindInputOptions extends IFindInputStyles {
3232
}
3333

3434
export interface IFindInputStyles extends IInputBoxStyles {
35-
inputActiveOptionBorder?: Color | null;
35+
inputActiveOptionBorder?: Color;
3636
}
3737

3838
const NLS_DEFAULT_LABEL = nls.localize('defaultLabel', "input");
@@ -48,20 +48,20 @@ export class FindInput extends Widget {
4848
private label: string;
4949
private fixFocusOnOptionClickEnabled = true;
5050

51-
private inputActiveOptionBorder?: Color | null;
52-
private inputBackground?: Color | null;
53-
private inputForeground?: Color | null;
54-
private inputBorder?: Color | null;
55-
56-
private inputValidationInfoBorder?: Color | null;
57-
private inputValidationInfoBackground?: Color | null;
58-
private inputValidationInfoForeground?: Color | null;
59-
private inputValidationWarningBorder?: Color | null;
60-
private inputValidationWarningBackground?: Color | null;
61-
private inputValidationWarningForeground?: Color | null;
62-
private inputValidationErrorBorder?: Color | null;
63-
private inputValidationErrorBackground?: Color | null;
64-
private inputValidationErrorForeground?: Color | null;
51+
private inputActiveOptionBorder?: Color;
52+
private inputBackground?: Color;
53+
private inputForeground?: Color;
54+
private inputBorder?: Color;
55+
56+
private inputValidationInfoBorder?: Color;
57+
private inputValidationInfoBackground?: Color;
58+
private inputValidationInfoForeground?: Color;
59+
private inputValidationWarningBorder?: Color;
60+
private inputValidationWarningBackground?: Color;
61+
private inputValidationWarningForeground?: Color;
62+
private inputValidationErrorBorder?: Color;
63+
private inputValidationErrorBackground?: Color;
64+
private inputValidationErrorForeground?: Color;
6565

6666
private regex: RegexCheckbox;
6767
private wholeWords: WholeWordsCheckbox;
@@ -202,7 +202,7 @@ export class FindInput extends Widget {
202202
protected applyStyles(): void {
203203
if (this.domNode) {
204204
const checkBoxStyles: ICheckboxStyles = {
205-
inputActiveOptionBorder: this.inputActiveOptionBorder || undefined,
205+
inputActiveOptionBorder: this.inputActiveOptionBorder,
206206
};
207207
this.regex.style(checkBoxStyles);
208208
this.wholeWords.style(checkBoxStyles);
@@ -313,7 +313,7 @@ export class FindInput extends Widget {
313313
this.regex = this._register(new RegexCheckbox({
314314
appendTitle: appendRegexLabel,
315315
isChecked: false,
316-
inputActiveOptionBorder: this.inputActiveOptionBorder || undefined
316+
inputActiveOptionBorder: this.inputActiveOptionBorder
317317
}));
318318
this._register(this.regex.onChange(viaKeyboard => {
319319
this._onDidOptionChange.fire(viaKeyboard);
@@ -330,7 +330,7 @@ export class FindInput extends Widget {
330330
this.wholeWords = this._register(new WholeWordsCheckbox({
331331
appendTitle: appendWholeWordsLabel,
332332
isChecked: false,
333-
inputActiveOptionBorder: this.inputActiveOptionBorder || undefined
333+
inputActiveOptionBorder: this.inputActiveOptionBorder
334334
}));
335335
this._register(this.wholeWords.onChange(viaKeyboard => {
336336
this._onDidOptionChange.fire(viaKeyboard);
@@ -344,7 +344,7 @@ export class FindInput extends Widget {
344344
this.caseSensitive = this._register(new CaseSensitiveCheckbox({
345345
appendTitle: appendCaseSensitiveLabel,
346346
isChecked: false,
347-
inputActiveOptionBorder: this.inputActiveOptionBorder || undefined
347+
inputActiveOptionBorder: this.inputActiveOptionBorder
348348
}));
349349
this._register(this.caseSensitive.onChange(viaKeyboard => {
350350
this._onDidOptionChange.fire(viaKeyboard);

src/vs/base/browser/ui/inputbox/inputBox.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ export interface IInputOptions extends IInputBoxStyles {
3232
}
3333

3434
export interface IInputBoxStyles {
35-
readonly inputBackground?: Color | null;
36-
readonly inputForeground?: Color | null;
37-
readonly inputBorder?: Color | null;
38-
readonly inputValidationInfoBorder?: Color | null;
39-
readonly inputValidationInfoBackground?: Color | null;
40-
readonly inputValidationInfoForeground?: Color | null;
41-
readonly inputValidationWarningBorder?: Color | null;
42-
readonly inputValidationWarningBackground?: Color | null;
43-
readonly inputValidationWarningForeground?: Color | null;
44-
readonly inputValidationErrorBorder?: Color | null;
45-
readonly inputValidationErrorBackground?: Color | null;
46-
readonly inputValidationErrorForeground?: Color | null;
35+
readonly inputBackground?: Color;
36+
readonly inputForeground?: Color;
37+
readonly inputBorder?: Color;
38+
readonly inputValidationInfoBorder?: Color;
39+
readonly inputValidationInfoBackground?: Color;
40+
readonly inputValidationInfoForeground?: Color;
41+
readonly inputValidationWarningBorder?: Color;
42+
readonly inputValidationWarningBackground?: Color;
43+
readonly inputValidationWarningForeground?: Color;
44+
readonly inputValidationErrorBorder?: Color;
45+
readonly inputValidationErrorBackground?: Color;
46+
readonly inputValidationErrorForeground?: Color;
4747
}
4848

4949
export interface IInputValidator {
@@ -96,19 +96,19 @@ export class InputBox extends Widget {
9696
private state: string | null = 'idle';
9797
private cachedHeight: number | null;
9898

99-
private inputBackground?: Color | null;
100-
private inputForeground?: Color | null;
101-
private inputBorder?: Color | null;
102-
103-
private inputValidationInfoBorder?: Color | null;
104-
private inputValidationInfoBackground?: Color | null;
105-
private inputValidationInfoForeground?: Color | null;
106-
private inputValidationWarningBorder?: Color | null;
107-
private inputValidationWarningBackground?: Color | null;
108-
private inputValidationWarningForeground?: Color | null;
109-
private inputValidationErrorBorder?: Color | null;
110-
private inputValidationErrorBackground?: Color | null;
111-
private inputValidationErrorForeground?: Color | null;
99+
private inputBackground?: Color;
100+
private inputForeground?: Color;
101+
private inputBorder?: Color;
102+
103+
private inputValidationInfoBorder?: Color;
104+
private inputValidationInfoBackground?: Color;
105+
private inputValidationInfoForeground?: Color;
106+
private inputValidationWarningBorder?: Color;
107+
private inputValidationWarningBackground?: Color;
108+
private inputValidationWarningForeground?: Color;
109+
private inputValidationErrorBorder?: Color;
110+
private inputValidationErrorBackground?: Color;
111+
private inputValidationErrorForeground?: Color;
112112

113113
private _onDidChange = this._register(new Emitter<string>());
114114
public readonly onDidChange: Event<string> = this._onDidChange.event;

src/vs/editor/contrib/find/findWidget.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -530,19 +530,19 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
530530

531531
private _applyTheme(theme: ITheme) {
532532
let inputStyles: IFindInputStyles = {
533-
inputActiveOptionBorder: theme.getColor(inputActiveOptionBorder),
534-
inputBackground: theme.getColor(inputBackground),
535-
inputForeground: theme.getColor(inputForeground),
536-
inputBorder: theme.getColor(inputBorder),
537-
inputValidationInfoBackground: theme.getColor(inputValidationInfoBackground),
538-
inputValidationInfoForeground: theme.getColor(inputValidationInfoForeground),
539-
inputValidationInfoBorder: theme.getColor(inputValidationInfoBorder),
540-
inputValidationWarningBackground: theme.getColor(inputValidationWarningBackground),
541-
inputValidationWarningForeground: theme.getColor(inputValidationWarningForeground),
542-
inputValidationWarningBorder: theme.getColor(inputValidationWarningBorder),
543-
inputValidationErrorBackground: theme.getColor(inputValidationErrorBackground),
544-
inputValidationErrorForeground: theme.getColor(inputValidationErrorForeground),
545-
inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder)
533+
inputActiveOptionBorder: theme.getColor(inputActiveOptionBorder) || undefined,
534+
inputBackground: theme.getColor(inputBackground) || undefined,
535+
inputForeground: theme.getColor(inputForeground) || undefined,
536+
inputBorder: theme.getColor(inputBorder) || undefined,
537+
inputValidationInfoBackground: theme.getColor(inputValidationInfoBackground) || undefined,
538+
inputValidationInfoForeground: theme.getColor(inputValidationInfoForeground) || undefined,
539+
inputValidationInfoBorder: theme.getColor(inputValidationInfoBorder) || undefined,
540+
inputValidationWarningBackground: theme.getColor(inputValidationWarningBackground) || undefined,
541+
inputValidationWarningForeground: theme.getColor(inputValidationWarningForeground) || undefined,
542+
inputValidationWarningBorder: theme.getColor(inputValidationWarningBorder) || undefined,
543+
inputValidationErrorBackground: theme.getColor(inputValidationErrorBackground) || undefined,
544+
inputValidationErrorForeground: theme.getColor(inputValidationErrorForeground) || undefined,
545+
inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder) || undefined,
546546
};
547547
this._findInput.style(inputStyles);
548548
this._replaceInputBox.style(inputStyles);

src/vs/editor/contrib/find/simpleFindWidget.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import 'vs/css!./simpleFindWidget';
77
import * as nls from 'vs/nls';
88
import * as dom from 'vs/base/browser/dom';
9-
import { FindInput } from 'vs/base/browser/ui/findinput/findInput';
9+
import { FindInput, IFindInputStyles } from 'vs/base/browser/ui/findinput/findInput';
1010
import { Widget } from 'vs/base/browser/ui/widget';
1111
import { Delayer } from 'vs/base/common/async';
1212
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
@@ -159,20 +159,20 @@ export abstract class SimpleFindWidget extends Widget {
159159
}
160160

161161
public updateTheme(theme: ITheme): void {
162-
const inputStyles = {
163-
inputActiveOptionBorder: theme.getColor(inputActiveOptionBorder),
164-
inputBackground: theme.getColor(inputBackground),
165-
inputForeground: theme.getColor(inputForeground),
166-
inputBorder: theme.getColor(inputBorder),
167-
inputValidationInfoBackground: theme.getColor(inputValidationInfoBackground),
168-
inputValidationInfoForeground: theme.getColor(inputValidationInfoForeground),
169-
inputValidationInfoBorder: theme.getColor(inputValidationInfoBorder),
170-
inputValidationWarningBackground: theme.getColor(inputValidationWarningBackground),
171-
inputValidationWarningForeground: theme.getColor(inputValidationWarningForeground),
172-
inputValidationWarningBorder: theme.getColor(inputValidationWarningBorder),
173-
inputValidationErrorBackground: theme.getColor(inputValidationErrorBackground),
174-
inputValidationErrorForeground: theme.getColor(inputValidationErrorForeground),
175-
inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder)
162+
const inputStyles: IFindInputStyles = {
163+
inputActiveOptionBorder: theme.getColor(inputActiveOptionBorder) || undefined,
164+
inputBackground: theme.getColor(inputBackground) || undefined,
165+
inputForeground: theme.getColor(inputForeground) || undefined,
166+
inputBorder: theme.getColor(inputBorder) || undefined,
167+
inputValidationInfoBackground: theme.getColor(inputValidationInfoBackground) || undefined,
168+
inputValidationInfoForeground: theme.getColor(inputValidationInfoForeground) || undefined,
169+
inputValidationInfoBorder: theme.getColor(inputValidationInfoBorder) || undefined,
170+
inputValidationWarningBackground: theme.getColor(inputValidationWarningBackground) || undefined,
171+
inputValidationWarningForeground: theme.getColor(inputValidationWarningForeground) || undefined,
172+
inputValidationWarningBorder: theme.getColor(inputValidationWarningBorder) || undefined,
173+
inputValidationErrorBackground: theme.getColor(inputValidationErrorBackground) || undefined,
174+
inputValidationErrorForeground: theme.getColor(inputValidationErrorForeground) || undefined,
175+
inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder) || undefined
176176
};
177177
this._findInput.style(inputStyles);
178178
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export class MarkerNavigationWidget extends ZoneWidget {
165165
private _message: MessageWidget;
166166
private _callOnDispose: IDisposable[] = [];
167167
private _severity: MarkerSeverity;
168-
private _backgroundColor: Color | null;
168+
private _backgroundColor?: Color;
169169
private _onDidSelectRelatedInformation = new Emitter<IRelatedInformation>();
170170

171171
readonly onDidSelectRelatedInformation: Event<IRelatedInformation> = this._onDidSelectRelatedInformation.event;
@@ -185,7 +185,7 @@ export class MarkerNavigationWidget extends ZoneWidget {
185185
}
186186

187187
private _applyTheme(theme: ITheme) {
188-
this._backgroundColor = theme.getColor(editorMarkerNavigationBackground);
188+
this._backgroundColor = theme.getColor(editorMarkerNavigationBackground) || undefined;
189189
let colorId = editorMarkerNavigationError;
190190
if (this._severity === MarkerSeverity.Warning) {
191191
colorId = editorMarkerNavigationWarning;

src/vs/editor/contrib/referenceSearch/peekViewWidget.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ export function getOuterEditor(accessor: ServicesAccessor): ICodeEditor | null {
3434
}
3535

3636
export interface IPeekViewStyles extends IStyles {
37-
headerBackgroundColor?: Color | null;
38-
primaryHeadingColor?: Color | null;
39-
secondaryHeadingColor?: Color | null;
37+
headerBackgroundColor?: Color;
38+
primaryHeadingColor?: Color;
39+
secondaryHeadingColor?: Color;
4040
}
4141

4242
export type IPeekViewOptions = IOptions & IPeekViewStyles;

src/vs/editor/contrib/referenceSearch/referencesWidget.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ export class ReferenceWidget extends PeekViewWidget {
279279
arrowColor: borderColor,
280280
frameColor: borderColor,
281281
headerBackgroundColor: theme.getColor(peekViewTitleBackground) || Color.transparent,
282-
primaryHeadingColor: theme.getColor(peekViewTitleForeground),
283-
secondaryHeadingColor: theme.getColor(peekViewTitleInfoForeground)
282+
primaryHeadingColor: theme.getColor(peekViewTitleForeground) || undefined,
283+
secondaryHeadingColor: theme.getColor(peekViewTitleInfoForeground) || undefined
284284
});
285285
}
286286

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ class ColorRegistry implements IColorRegistry {
132132
}
133133

134134
public resolveDefaultColor(id: ColorIdentifier, theme: ITheme): Color | null {
135-
let colorDesc = this.colorsById[id];
135+
const colorDesc = this.colorsById[id];
136136
if (colorDesc && colorDesc.defaults) {
137-
let colorValue = colorDesc.defaults[theme.type];
137+
const colorValue = colorDesc.defaults[theme.type];
138138
return resolveColorValue(colorValue, theme);
139139
}
140140
return null;

src/vs/workbench/browser/parts/quickinput/quickInputBox.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,18 @@ export class QuickInputBox {
100100

101101
style(theme: ITheme) {
102102
this.inputBox.style({
103-
inputForeground: theme.getColor(inputForeground),
104-
inputBackground: theme.getColor(inputBackground),
105-
inputBorder: theme.getColor(inputBorder),
106-
inputValidationInfoBackground: theme.getColor(inputValidationInfoBackground),
107-
inputValidationInfoForeground: theme.getColor(inputValidationInfoForeground),
108-
inputValidationInfoBorder: theme.getColor(inputValidationInfoBorder),
109-
inputValidationWarningBackground: theme.getColor(inputValidationWarningBackground),
110-
inputValidationWarningForeground: theme.getColor(inputValidationWarningForeground),
111-
inputValidationWarningBorder: theme.getColor(inputValidationWarningBorder),
112-
inputValidationErrorBackground: theme.getColor(inputValidationErrorBackground),
113-
inputValidationErrorForeground: theme.getColor(inputValidationErrorForeground),
114-
inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder),
103+
inputForeground: theme.getColor(inputForeground) || undefined,
104+
inputBackground: theme.getColor(inputBackground) || undefined,
105+
inputBorder: theme.getColor(inputBorder) || undefined,
106+
inputValidationInfoBackground: theme.getColor(inputValidationInfoBackground) || undefined,
107+
inputValidationInfoForeground: theme.getColor(inputValidationInfoForeground) || undefined,
108+
inputValidationInfoBorder: theme.getColor(inputValidationInfoBorder) || undefined,
109+
inputValidationWarningBackground: theme.getColor(inputValidationWarningBackground) || undefined,
110+
inputValidationWarningForeground: theme.getColor(inputValidationWarningForeground) || undefined,
111+
inputValidationWarningBorder: theme.getColor(inputValidationWarningBorder) || undefined,
112+
inputValidationErrorBackground: theme.getColor(inputValidationErrorBackground) || undefined,
113+
inputValidationErrorForeground: theme.getColor(inputValidationErrorForeground) || undefined,
114+
inputValidationErrorBorder: theme.getColor(inputValidationErrorBorder) || undefined,
115115
});
116116
}
117117

src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,8 @@ class DirtyDiffWidget extends PeekViewWidget {
365365
arrowColor: borderColor,
366366
frameColor: borderColor,
367367
headerBackgroundColor: theme.getColor(peekViewTitleBackground) || Color.transparent,
368-
primaryHeadingColor: theme.getColor(peekViewTitleForeground),
369-
secondaryHeadingColor: theme.getColor(peekViewTitleInfoForeground)
368+
primaryHeadingColor: theme.getColor(peekViewTitleForeground) || undefined,
369+
secondaryHeadingColor: theme.getColor(peekViewTitleInfoForeground) || undefined
370370
});
371371
}
372372

0 commit comments

Comments
 (0)