debt - more layering fixes
This commit is contained in:
parent
f0321e3087
commit
420f8dde79
|
@ -11,7 +11,7 @@ import { IWorkbenchActionRegistry, Extensions, CATEGORIES } from 'vs/workbench/c
|
|||
import { ReportPerformanceIssueUsingReporterAction, OpenProcessExplorer } from 'vs/workbench/contrib/issue/electron-sandbox/issueActions';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IWorkbenchIssueService } from 'vs/workbench/services/issue/common/issue';
|
||||
import { WorkbenchIssueService } from 'vs/workbench/contrib/issue/electron-sandbox/issueService';
|
||||
import { WorkbenchIssueService } from 'vs/workbench/services/issue/electron-sandbox/issueService';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { IssueReporterData } from 'vs/platform/issue/common/issue';
|
||||
import { IIssueService } from 'vs/platform/issue/electron-sandbox/issue';
|
||||
|
|
|
@ -1,128 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IssueReporterStyles, IssueReporterData, ProcessExplorerData, IssueReporterExtensionData } from 'vs/platform/issue/common/issue';
|
||||
import { IIssueService } from 'vs/platform/issue/electron-sandbox/issue';
|
||||
import { IColorTheme, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { textLinkForeground, inputBackground, inputBorder, inputForeground, buttonBackground, buttonHoverBackground, buttonForeground, inputValidationErrorBorder, foreground, inputActiveOptionBorder, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, editorBackground, editorForeground, listHoverBackground, listHoverForeground, textLinkActiveForeground, inputValidationErrorBackground, inputValidationErrorForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IWorkbenchExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { getZoomLevel } from 'vs/base/browser/browser';
|
||||
import { IWorkbenchIssueService } from 'vs/workbench/services/issue/common/issue';
|
||||
import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService';
|
||||
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { process } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { ITASExperimentService } from 'vs/workbench/services/experiment/common/experimentService';
|
||||
import { IAuthenticationService } from 'vs/workbench/services/authentication/browser/authenticationService';
|
||||
|
||||
export class WorkbenchIssueService implements IWorkbenchIssueService {
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
constructor(
|
||||
@IIssueService private readonly issueService: IIssueService,
|
||||
@IThemeService private readonly themeService: IThemeService,
|
||||
@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,
|
||||
@IWorkbenchExtensionEnablementService private readonly extensionEnablementService: IWorkbenchExtensionEnablementService,
|
||||
@INativeWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@ITASExperimentService private readonly experimentService: ITASExperimentService,
|
||||
@IAuthenticationService private readonly authenticationService: IAuthenticationService
|
||||
) { }
|
||||
|
||||
async openReporter(dataOverrides: Partial<IssueReporterData> = {}): Promise<void> {
|
||||
const extensionData: IssueReporterExtensionData[] = [];
|
||||
try {
|
||||
const extensions = await this.extensionManagementService.getInstalled();
|
||||
const enabledExtensions = extensions.filter(extension => this.extensionEnablementService.isEnabled(extension) || (dataOverrides.extensionId && extension.identifier.id === dataOverrides.extensionId));
|
||||
extensionData.push(...enabledExtensions.map((extension): IssueReporterExtensionData => {
|
||||
const { manifest } = extension;
|
||||
const manifestKeys = manifest.contributes ? Object.keys(manifest.contributes) : [];
|
||||
const isTheme = !manifest.activationEvents && manifestKeys.length === 1 && manifestKeys[0] === 'themes';
|
||||
const isBuiltin = extension.type === ExtensionType.System;
|
||||
return {
|
||||
name: manifest.name,
|
||||
publisher: manifest.publisher,
|
||||
version: manifest.version,
|
||||
repositoryUrl: manifest.repository && manifest.repository.url,
|
||||
bugsUrl: manifest.bugs && manifest.bugs.url,
|
||||
displayName: manifest.displayName,
|
||||
id: extension.identifier.id,
|
||||
isTheme,
|
||||
isBuiltin,
|
||||
};
|
||||
}));
|
||||
} catch (e) {
|
||||
extensionData.push({
|
||||
name: 'Workbench Issue Service',
|
||||
publisher: 'Unknown',
|
||||
version: '0.0.0',
|
||||
repositoryUrl: undefined,
|
||||
bugsUrl: undefined,
|
||||
displayName: `Extensions not loaded: ${e}`,
|
||||
id: 'workbench.issue',
|
||||
isTheme: false,
|
||||
isBuiltin: true
|
||||
});
|
||||
}
|
||||
const experiments = await this.experimentService.getCurrentExperiments();
|
||||
const githubSessions = await this.authenticationService.getSessions('github');
|
||||
const potentialSessions = githubSessions.filter(session => session.scopes.includes('repo'));
|
||||
const theme = this.themeService.getColorTheme();
|
||||
const issueReporterData: IssueReporterData = Object.assign({
|
||||
styles: getIssueReporterStyles(theme),
|
||||
zoomLevel: getZoomLevel(),
|
||||
enabledExtensions: extensionData,
|
||||
experiments: experiments?.join('\n'),
|
||||
githubAccessToken: potentialSessions[0]?.accessToken
|
||||
}, dataOverrides);
|
||||
return this.issueService.openReporter(issueReporterData);
|
||||
}
|
||||
|
||||
openProcessExplorer(): Promise<void> {
|
||||
const theme = this.themeService.getColorTheme();
|
||||
const data: ProcessExplorerData = {
|
||||
pid: this.environmentService.configuration.mainPid,
|
||||
zoomLevel: getZoomLevel(),
|
||||
styles: {
|
||||
backgroundColor: getColor(theme, editorBackground),
|
||||
color: getColor(theme, editorForeground),
|
||||
hoverBackground: getColor(theme, listHoverBackground),
|
||||
hoverForeground: getColor(theme, listHoverForeground)
|
||||
},
|
||||
platform: process.platform,
|
||||
applicationName: this.productService.applicationName
|
||||
};
|
||||
return this.issueService.openProcessExplorer(data);
|
||||
}
|
||||
}
|
||||
|
||||
export function getIssueReporterStyles(theme: IColorTheme): IssueReporterStyles {
|
||||
return {
|
||||
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),
|
||||
inputErrorBackground: getColor(theme, inputValidationErrorBackground),
|
||||
inputErrorForeground: getColor(theme, inputValidationErrorForeground),
|
||||
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: IColorTheme, key: string): string | undefined {
|
||||
const color = theme.getColor(key);
|
||||
return color ? color.toString() : undefined;
|
||||
}
|
|
@ -3,7 +3,129 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IssueReporterStyles, IssueReporterData, ProcessExplorerData, IssueReporterExtensionData } from 'vs/platform/issue/common/issue';
|
||||
import { IIssueService } from 'vs/platform/issue/electron-sandbox/issue';
|
||||
import { IColorTheme, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { textLinkForeground, inputBackground, inputBorder, inputForeground, buttonBackground, buttonHoverBackground, buttonForeground, inputValidationErrorBorder, foreground, inputActiveOptionBorder, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, editorBackground, editorForeground, listHoverBackground, listHoverForeground, textLinkActiveForeground, inputValidationErrorBackground, inputValidationErrorForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IWorkbenchExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { getZoomLevel } from 'vs/base/browser/browser';
|
||||
import { IWorkbenchIssueService } from 'vs/workbench/services/issue/common/issue';
|
||||
import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService';
|
||||
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { process } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { ITASExperimentService } from 'vs/workbench/services/experiment/common/experimentService';
|
||||
import { IAuthenticationService } from 'vs/workbench/services/authentication/browser/authenticationService';
|
||||
import { registerMainProcessRemoteService } from 'vs/platform/ipc/electron-sandbox/services';
|
||||
|
||||
export class WorkbenchIssueService implements IWorkbenchIssueService {
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
constructor(
|
||||
@IIssueService private readonly issueService: IIssueService,
|
||||
@IThemeService private readonly themeService: IThemeService,
|
||||
@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,
|
||||
@IWorkbenchExtensionEnablementService private readonly extensionEnablementService: IWorkbenchExtensionEnablementService,
|
||||
@INativeWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@ITASExperimentService private readonly experimentService: ITASExperimentService,
|
||||
@IAuthenticationService private readonly authenticationService: IAuthenticationService
|
||||
) { }
|
||||
|
||||
async openReporter(dataOverrides: Partial<IssueReporterData> = {}): Promise<void> {
|
||||
const extensionData: IssueReporterExtensionData[] = [];
|
||||
try {
|
||||
const extensions = await this.extensionManagementService.getInstalled();
|
||||
const enabledExtensions = extensions.filter(extension => this.extensionEnablementService.isEnabled(extension) || (dataOverrides.extensionId && extension.identifier.id === dataOverrides.extensionId));
|
||||
extensionData.push(...enabledExtensions.map((extension): IssueReporterExtensionData => {
|
||||
const { manifest } = extension;
|
||||
const manifestKeys = manifest.contributes ? Object.keys(manifest.contributes) : [];
|
||||
const isTheme = !manifest.activationEvents && manifestKeys.length === 1 && manifestKeys[0] === 'themes';
|
||||
const isBuiltin = extension.type === ExtensionType.System;
|
||||
return {
|
||||
name: manifest.name,
|
||||
publisher: manifest.publisher,
|
||||
version: manifest.version,
|
||||
repositoryUrl: manifest.repository && manifest.repository.url,
|
||||
bugsUrl: manifest.bugs && manifest.bugs.url,
|
||||
displayName: manifest.displayName,
|
||||
id: extension.identifier.id,
|
||||
isTheme,
|
||||
isBuiltin,
|
||||
};
|
||||
}));
|
||||
} catch (e) {
|
||||
extensionData.push({
|
||||
name: 'Workbench Issue Service',
|
||||
publisher: 'Unknown',
|
||||
version: '0.0.0',
|
||||
repositoryUrl: undefined,
|
||||
bugsUrl: undefined,
|
||||
displayName: `Extensions not loaded: ${e}`,
|
||||
id: 'workbench.issue',
|
||||
isTheme: false,
|
||||
isBuiltin: true
|
||||
});
|
||||
}
|
||||
const experiments = await this.experimentService.getCurrentExperiments();
|
||||
const githubSessions = await this.authenticationService.getSessions('github');
|
||||
const potentialSessions = githubSessions.filter(session => session.scopes.includes('repo'));
|
||||
const theme = this.themeService.getColorTheme();
|
||||
const issueReporterData: IssueReporterData = Object.assign({
|
||||
styles: getIssueReporterStyles(theme),
|
||||
zoomLevel: getZoomLevel(),
|
||||
enabledExtensions: extensionData,
|
||||
experiments: experiments?.join('\n'),
|
||||
githubAccessToken: potentialSessions[0]?.accessToken
|
||||
}, dataOverrides);
|
||||
return this.issueService.openReporter(issueReporterData);
|
||||
}
|
||||
|
||||
openProcessExplorer(): Promise<void> {
|
||||
const theme = this.themeService.getColorTheme();
|
||||
const data: ProcessExplorerData = {
|
||||
pid: this.environmentService.configuration.mainPid,
|
||||
zoomLevel: getZoomLevel(),
|
||||
styles: {
|
||||
backgroundColor: getColor(theme, editorBackground),
|
||||
color: getColor(theme, editorForeground),
|
||||
hoverBackground: getColor(theme, listHoverBackground),
|
||||
hoverForeground: getColor(theme, listHoverForeground)
|
||||
},
|
||||
platform: process.platform,
|
||||
applicationName: this.productService.applicationName
|
||||
};
|
||||
return this.issueService.openProcessExplorer(data);
|
||||
}
|
||||
}
|
||||
|
||||
export function getIssueReporterStyles(theme: IColorTheme): IssueReporterStyles {
|
||||
return {
|
||||
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),
|
||||
inputErrorBackground: getColor(theme, inputValidationErrorBackground),
|
||||
inputErrorForeground: getColor(theme, inputValidationErrorForeground),
|
||||
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: IColorTheme, key: string): string | undefined {
|
||||
const color = theme.getColor(key);
|
||||
return color ? color.toString() : undefined;
|
||||
}
|
||||
|
||||
registerMainProcessRemoteService(IIssueService, 'issue', { supportsDelayedInstantiation: true });
|
||||
|
|
Loading…
Reference in a new issue