提交 90416b8e 编写于 作者: M Matt Bierner

Strict null check workbench issue service

上级 ebef92f9
......@@ -702,6 +702,7 @@
"./vs/workbench/services/hash/common/hashService.ts",
"./vs/workbench/services/hash/node/hashService.ts",
"./vs/workbench/services/issue/common/issue.ts",
"./vs/workbench/services/issue/electron-browser/workbenchIssueService.ts",
"./vs/workbench/services/jsonschemas/common/jsonValidationExtensionPoint.ts",
"./vs/workbench/services/keybinding/common/keybindingIO.ts",
"./vs/workbench/services/keybinding/common/keyboardMapper.ts",
......
......@@ -171,7 +171,9 @@ function applyStyles(styles: ProcessExplorerStyles): void {
if (document.head) {
document.head.appendChild(styleTag);
}
document.body.style.color = styles.color;
if (styles.color) {
document.body.style.color = styles.color;
}
}
function applyZoom(zoomLevel: number): void {
......
......@@ -10,8 +10,8 @@ export const IIssueService = createDecorator<IIssueService>('issueService');
// Since data sent through the service is serialized to JSON, functions will be lost, so Color objects
// should not be sent as their 'toString' method will be stripped. Instead convert to strings before sending.
export interface WindowStyles {
backgroundColor: string;
color: string;
backgroundColor?: string;
color?: string;
}
export interface WindowData {
styles: WindowStyles;
......@@ -26,19 +26,19 @@ export const enum IssueType {
}
export interface IssueReporterStyles extends WindowStyles {
textLinkColor: string;
textLinkActiveForeground: string;
inputBackground: string;
inputForeground: string;
inputBorder: string;
inputErrorBorder: string;
inputActiveBorder: string;
buttonBackground: string;
buttonForeground: string;
buttonHoverBackground: string;
sliderBackgroundColor: string;
sliderHoverColor: string;
sliderActiveColor: string;
textLinkColor?: string;
textLinkActiveForeground?: string;
inputBackground?: string;
inputForeground?: string;
inputBorder?: string;
inputErrorBorder?: string;
inputActiveBorder?: string;
buttonBackground?: string;
buttonForeground?: string;
buttonHoverBackground?: string;
sliderBackgroundColor?: string;
sliderHoverColor?: string;
sliderActiveColor?: string;
}
export interface IssueReporterExtensionData {
......@@ -75,9 +75,9 @@ export interface IssueReporterFeatures {
}
export interface ProcessExplorerStyles extends WindowStyles {
hoverBackground: string;
hoverForeground: string;
highlightForeground: string;
hoverBackground?: string;
hoverForeground?: string;
highlightForeground?: string;
}
export interface ProcessExplorerData extends WindowData {
......
......@@ -22,8 +22,7 @@ export class WorkbenchIssueService implements IWorkbenchIssueService {
@IExtensionManagementService private extensionManagementService: IExtensionManagementService,
@IExtensionEnablementService private extensionEnablementService: IExtensionEnablementService,
@IWindowService private windowService: IWindowService
) {
}
) { }
openReporter(dataOverrides: Partial<IssueReporterData> = {}): Promise<void> {
return this.extensionManagementService.getInstalled(LocalExtensionType.User).then(extensions => {
......@@ -63,11 +62,11 @@ export class WorkbenchIssueService implements IWorkbenchIssueService {
pid: this.windowService.getConfiguration().mainPid,
zoomLevel: webFrame.getZoomLevel(),
styles: {
backgroundColor: theme.getColor(editorBackground) && theme.getColor(editorBackground).toString(),
color: theme.getColor(editorForeground).toString(),
hoverBackground: theme.getColor(listHoverBackground) && theme.getColor(listHoverBackground).toString(),
hoverForeground: theme.getColor(listHoverForeground) && theme.getColor(listHoverForeground).toString(),
highlightForeground: theme.getColor(listHighlightForeground) && theme.getColor(listHighlightForeground).toString()
backgroundColor: getColor(theme, editorBackground),
color: getColor(theme, editorForeground),
hoverBackground: getColor(theme, listHoverBackground),
hoverForeground: getColor(theme, listHoverForeground),
highlightForeground: getColor(theme, listHighlightForeground),
}
};
return this.issueService.openProcessExplorer(data);
......@@ -76,20 +75,26 @@ export class WorkbenchIssueService implements IWorkbenchIssueService {
export function getIssueReporterStyles(theme: ITheme): IssueReporterStyles {
return {
backgroundColor: theme.getColor(SIDE_BAR_BACKGROUND) && theme.getColor(SIDE_BAR_BACKGROUND).toString(),
color: theme.getColor(foreground).toString(),
textLinkColor: theme.getColor(textLinkForeground) && theme.getColor(textLinkForeground).toString(),
textLinkActiveForeground: theme.getColor(textLinkActiveForeground) && theme.getColor(textLinkActiveForeground).toString(),
inputBackground: theme.getColor(inputBackground) && theme.getColor(inputBackground).toString(),
inputForeground: theme.getColor(inputForeground) && theme.getColor(inputForeground).toString(),
inputBorder: theme.getColor(inputBorder) && theme.getColor(inputBorder).toString(),
inputActiveBorder: theme.getColor(inputActiveOptionBorder) && theme.getColor(inputActiveOptionBorder).toString(),
inputErrorBorder: theme.getColor(inputValidationErrorBorder) && theme.getColor(inputValidationErrorBorder).toString(),
buttonBackground: theme.getColor(buttonBackground) && theme.getColor(buttonBackground).toString(),
buttonForeground: theme.getColor(buttonForeground) && theme.getColor(buttonForeground).toString(),
buttonHoverBackground: theme.getColor(buttonHoverBackground) && theme.getColor(buttonHoverBackground).toString(),
sliderActiveColor: theme.getColor(scrollbarSliderActiveBackground) && theme.getColor(scrollbarSliderActiveBackground).toString(),
sliderBackgroundColor: theme.getColor(scrollbarSliderBackground) && theme.getColor(scrollbarSliderBackground).toString(),
sliderHoverColor: theme.getColor(scrollbarSliderHoverBackground) && theme.getColor(scrollbarSliderHoverBackground).toString()
backgroundColor: getColor(theme, SIDE_BAR_BACKGROUND),
color: getColor(theme, foreground),
textLinkColor: getColor(theme, textLinkForeground),
textLinkActiveForeground: getColor(theme, textLinkActiveForeground),
inputBackground: getColor(theme, inputBackground),
inputForeground: getColor(theme, inputForeground),
inputBorder: getColor(theme, inputBorder),
inputActiveBorder: getColor(theme, inputActiveOptionBorder),
inputErrorBorder: getColor(theme, inputValidationErrorBorder),
buttonBackground: getColor(theme, buttonBackground),
buttonForeground: getColor(theme, buttonForeground),
buttonHoverBackground: getColor(theme, buttonHoverBackground),
sliderActiveColor: getColor(theme, scrollbarSliderActiveBackground),
sliderBackgroundColor: getColor(theme, scrollbarSliderBackground),
sliderHoverColor: getColor(theme, scrollbarSliderHoverBackground),
};
}
function getColor(theme: ITheme, key: string): string | undefined {
const color = theme.getColor(key);
return color ? color.toString() : undefined;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册