55
66import 'vs/css!./media/issueReporter' ;
77import 'vs/base/browser/ui/codicons/codiconStyles' ; // make sure codicon css is loaded
8- import * as os from 'os' ;
98import { ElectronService , IElectronService } from 'vs/platform/electron/electron-sandbox/electron' ;
10- import { ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals' ;
9+ import { ipcRenderer , process } from 'vs/base/parts/sandbox/electron-sandbox/globals' ;
1110import { applyZoom , zoomIn , zoomOut } from 'vs/platform/windows/electron-sandbox/window' ;
1211import { $ , windowOpenNoOpener , addClass } from 'vs/base/browser/dom' ;
1312import { Button } from 'vs/base/browser/ui/button/button' ;
@@ -17,29 +16,15 @@ import { debounce } from 'vs/base/common/decorators';
1716import { Disposable } from 'vs/base/common/lifecycle' ;
1817import * as platform from 'vs/base/common/platform' ;
1918import { escape } from 'vs/base/common/strings' ;
20- import { getDelayedChannel , createChannelSender } from 'vs/base/parts/ipc/common/ipc' ;
21- import { connect as connectNet } from 'vs/base/parts/ipc/node/ipc.net' ;
2219import { normalizeGitHubUrl } from 'vs/platform/issue/common/issueReporterUtil' ;
23- import { IssueReporterData as IssueReporterModelData , IssueReporterModel } from 'vs/code/electron-browser /issue/issueReporterModel' ;
24- import BaseHtml from 'vs/code/electron-browser /issue/issueReporterPage' ;
20+ import { IssueReporterData as IssueReporterModelData , IssueReporterModel } from 'vs/code/electron-sandbox /issue/issueReporterModel' ;
21+ import BaseHtml from 'vs/code/electron-sandbox /issue/issueReporterPage' ;
2522import { localize } from 'vs/nls' ;
2623import { isRemoteDiagnosticError , SystemInfo } from 'vs/platform/diagnostics/common/diagnostics' ;
27- import { EnvironmentService , INativeEnvironmentService } from 'vs/platform/environment/node/environmentService' ;
28- import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService' ;
2924import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection' ;
3025import { IMainProcessService , MainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService' ;
31- import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService' ;
3226import { ISettingsSearchIssueReporterData , IssueReporterData , IssueReporterExtensionData , IssueReporterFeatures , IssueReporterStyles , IssueType } from 'vs/platform/issue/common/issue' ;
33- import { getLogLevel , ILogService } from 'vs/platform/log/common/log' ;
34- import { FollowerLogService , LoggerChannelClient } from 'vs/platform/log/common/logIpc' ;
35- import { SpdLogService } from 'vs/platform/log/node/spdlogService' ;
36- import product from 'vs/platform/product/common/product' ;
37- import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
38- import { ITelemetryServiceConfig , TelemetryService } from 'vs/platform/telemetry/common/telemetryService' ;
39- import { combinedAppender , LogAppender , NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils' ;
40- import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties' ;
41- import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc' ;
42- import { INativeWindowConfiguration } from 'vs/platform/windows/node/window' ;
27+ import { IWindowConfiguration } from 'vs/platform/windows/common/windows' ;
4328
4429const MAX_URL_LENGTH = 2045 ;
4530
@@ -49,9 +34,23 @@ interface SearchResult {
4934 state ?: string ;
5035}
5136
52- export interface IssueReporterConfiguration extends INativeWindowConfiguration {
37+ export interface IssueReporterConfiguration extends IWindowConfiguration {
38+ windowId : number ;
39+ disableExtensions : boolean ;
5340 data : IssueReporterData ;
5441 features : IssueReporterFeatures ;
42+ os : {
43+ type : string ;
44+ arch : string ;
45+ release : string ;
46+ } ,
47+ product : {
48+ nameShort : string ;
49+ version : string ;
50+ commit : string | undefined ;
51+ date : string | undefined ;
52+ reportIssueUrl : string | undefined ;
53+ }
5554}
5655
5756export function startup ( configuration : IssueReporterConfiguration ) {
@@ -66,10 +65,7 @@ export function startup(configuration: IssueReporterConfiguration) {
6665}
6766
6867export class IssueReporter extends Disposable {
69- private environmentService ! : INativeEnvironmentService ;
7068 private electronService ! : IElectronService ;
71- private telemetryService ! : ITelemetryService ;
72- private logService ! : ILogService ;
7369 private readonly issueReporterModel : IssueReporterModel ;
7470 private numberOfSearchResultsDisplayed = 0 ;
7571 private receivedSystemInfo = false ;
@@ -79,7 +75,7 @@ export class IssueReporter extends Disposable {
7975
8076 private readonly previewButton ! : Button ;
8177
82- constructor ( configuration : IssueReporterConfiguration ) {
78+ constructor ( private readonly configuration : IssueReporterConfiguration ) {
8379 super ( ) ;
8480
8581 this . initServices ( configuration ) ;
@@ -90,10 +86,10 @@ export class IssueReporter extends Disposable {
9086 this . issueReporterModel = new IssueReporterModel ( {
9187 issueType : configuration . data . issueType || IssueType . Bug ,
9288 versionInfo : {
93- vscodeVersion : `${ product . nameShort } ${ product . version } (${ product . commit || 'Commit unknown' } , ${ product . date || 'Date unknown' } )` ,
94- os : `${ os . type ( ) } ${ os . arch ( ) } ${ os . release ( ) } ${ isSnap ? ' snap' : '' } `
89+ vscodeVersion : `${ configuration . product . nameShort } ${ configuration . product . version } (${ configuration . product . commit || 'Commit unknown' } , ${ configuration . product . date || 'Date unknown' } )` ,
90+ os : `${ this . configuration . os . type } ${ this . configuration . os . arch } ${ this . configuration . os . release } ${ isSnap ? ' snap' : '' } `
9591 } ,
96- extensionsDisabled : ! ! this . environmentService . disableExtensions ,
92+ extensionsDisabled : ! ! configuration . disableExtensions ,
9793 fileOnExtension : configuration . data . extensionId ? ! targetExtension ?. isBuiltin : undefined ,
9894 selectedExtension : targetExtension ,
9995 } ) ;
@@ -121,7 +117,6 @@ export class IssueReporter extends Disposable {
121117 }
122118
123119 ipcRenderer . on ( 'vscode:issuePerformanceInfoResponse' , ( _ : unknown , info : Partial < IssueReporterData > ) => {
124- this . logService . trace ( 'issueReporter: Received performance data' ) ;
125120 this . issueReporterModel . update ( info ) ;
126121 this . receivedPerformanceInfo = true ;
127122
@@ -132,7 +127,6 @@ export class IssueReporter extends Disposable {
132127 } ) ;
133128
134129 ipcRenderer . on ( 'vscode:issueSystemInfoResponse' , ( _ : unknown , info : SystemInfo ) => {
135- this . logService . trace ( 'issueReporter: Received system data' ) ;
136130 this . issueReporterModel . update ( { systemInfo : info } ) ;
137131 this . receivedSystemInfo = true ;
138132
@@ -144,7 +138,6 @@ export class IssueReporter extends Disposable {
144138 if ( configuration . data . issueType === IssueType . PerformanceIssue ) {
145139 ipcRenderer . send ( 'vscode:issuePerformanceInfoRequest' ) ;
146140 }
147- this . logService . trace ( 'issueReporter: Sent data requests' ) ;
148141
149142 if ( window . document . documentElement . lang !== 'en' ) {
150143 show ( this . getElementById ( 'english' ) ) ;
@@ -266,7 +259,7 @@ export class IssueReporter extends Disposable {
266259 this . issueReporterModel . update ( { numberOfThemeExtesions, enabledNonThemeExtesions : nonThemes , allExtensions : installedExtensions } ) ;
267260 this . updateExtensionTable ( nonThemes , numberOfThemeExtesions ) ;
268261
269- if ( this . environmentService . disableExtensions || installedExtensions . length === 0 ) {
262+ if ( this . configuration . disableExtensions || installedExtensions . length === 0 ) {
270263 ( < HTMLButtonElement > this . getElementById ( 'disableExtensions' ) ) . disabled = true ;
271264 }
272265
@@ -314,40 +307,13 @@ export class IssueReporter extends Disposable {
314307 }
315308 }
316309
317- private initServices ( configuration : INativeWindowConfiguration ) : void {
310+ private initServices ( configuration : IssueReporterConfiguration ) : void {
318311 const serviceCollection = new ServiceCollection ( ) ;
319312 const mainProcessService = new MainProcessService ( configuration . windowId ) ;
320313 serviceCollection . set ( IMainProcessService , mainProcessService ) ;
321314
322315 this . electronService = new ElectronService ( configuration . windowId , mainProcessService ) as IElectronService ;
323316 serviceCollection . set ( IElectronService , this . electronService ) ;
324-
325- this . environmentService = new EnvironmentService ( configuration , configuration . execPath ) ;
326-
327- const logService = new SpdLogService ( `issuereporter${ configuration . windowId } ` , this . environmentService . logsPath , getLogLevel ( this . environmentService ) ) ;
328- const loggerClient = new LoggerChannelClient ( mainProcessService . getChannel ( 'logger' ) ) ;
329- this . logService = new FollowerLogService ( loggerClient , logService ) ;
330-
331- const sharedProcessService = createChannelSender < ISharedProcessService > ( mainProcessService . getChannel ( 'sharedProcess' ) ) ;
332-
333- const sharedProcess = sharedProcessService . whenSharedProcessReady ( )
334- . then ( ( ) => connectNet ( this . environmentService . sharedIPCHandle , `window:${ configuration . windowId } ` ) ) ;
335-
336- const instantiationService = new InstantiationService ( serviceCollection , true ) ;
337- if ( ! this . environmentService . isExtensionDevelopment && ! this . environmentService . args [ 'disable-telemetry' ] && ! ! product . enableTelemetry ) {
338- const channel = getDelayedChannel ( sharedProcess . then ( c => c . getChannel ( 'telemetryAppender' ) ) ) ;
339- const appender = combinedAppender ( new TelemetryAppenderClient ( channel ) , new LogAppender ( logService ) ) ;
340- const commonProperties = resolveCommonProperties ( product . commit || 'Commit unknown' , product . version , configuration . machineId , product . msftInternalDomains , this . environmentService . installSourcePath ) ;
341- const piiPaths = this . environmentService . extensionsPath ? [ this . environmentService . appRoot , this . environmentService . extensionsPath ] : [ this . environmentService . appRoot ] ;
342- const config : ITelemetryServiceConfig = { appender, commonProperties, piiPaths, sendErrorTelemetry : true } ;
343-
344- const telemetryService = instantiationService . createInstance ( TelemetryService , config ) ;
345- this . _register ( telemetryService ) ;
346-
347- this . telemetryService = telemetryService ;
348- } else {
349- this . telemetryService = NullTelemetryService ;
350- }
351317 }
352318
353319 private setEventHandlers ( ) : void {
@@ -617,11 +583,11 @@ export class IssueReporter extends Disposable {
617583 } , timeToWait * 1000 ) ;
618584 }
619585 }
620- } ) . catch ( e => {
621- this . logSearchError ( e ) ;
586+ } ) . catch ( _ => {
587+ // Ignore
622588 } ) ;
623- } ) . catch ( e => {
624- this . logSearchError ( e ) ;
589+ } ) . catch ( _ => {
590+ // Ignore
625591 } ) ;
626592 }
627593
@@ -648,11 +614,11 @@ export class IssueReporter extends Disposable {
648614 } else {
649615 throw new Error ( 'Unexpected response, no candidates property' ) ;
650616 }
651- } ) . catch ( ( error ) => {
652- this . logSearchError ( error ) ;
617+ } ) . catch ( _ => {
618+ // Ignore
653619 } ) ;
654- } ) . catch ( ( error ) => {
655- this . logSearchError ( error ) ;
620+ } ) . catch ( _ => {
621+ // Ignore
656622 } ) ;
657623 }
658624
@@ -705,18 +671,6 @@ export class IssueReporter extends Disposable {
705671 }
706672 }
707673
708- private logSearchError ( error : Error ) {
709- this . logService . warn ( 'issueReporter#search ' , error . message ) ;
710- type IssueReporterSearchErrorClassification = {
711- message : { classification : 'CallstackOrException' , purpose : 'PerformanceAndHealth' }
712- } ;
713-
714- type IssueReporterSearchError = {
715- message : string ;
716- } ;
717- this . telemetryService . publicLogError2 < IssueReporterSearchError , IssueReporterSearchErrorClassification > ( 'issueReporterSearchError' , { message : error . message } ) ;
718- }
719-
720674 private setUpTypes ( ) : void {
721675 const makeOption = ( issueType : IssueType , description : string ) => `<option value="${ issueType . valueOf ( ) } ">${ escape ( description ) } </option>` ;
722676
@@ -910,15 +864,6 @@ export class IssueReporter extends Disposable {
910864 return false ;
911865 }
912866
913- type IssueReporterSubmitClassification = {
914- issueType : { classification : 'SystemMetaData' , purpose : 'FeatureInsight' , isMeasurement : true } ;
915- numSimilarIssuesDisplayed : { classification : 'SystemMetaData' , purpose : 'FeatureInsight' , isMeasurement : true } ;
916- } ;
917- type IssueReporterSubmitEvent = {
918- issueType : any ;
919- numSimilarIssuesDisplayed : number ;
920- } ;
921- this . telemetryService . publicLog2 < IssueReporterSubmitEvent , IssueReporterSubmitClassification > ( 'issueReporterSubmit' , { issueType : this . issueReporterModel . getData ( ) . issueType , numSimilarIssuesDisplayed : this . numberOfSearchResultsDisplayed } ) ;
922867 this . hasBeenSubmitted = true ;
923868
924869 const baseUrl = this . getIssueUrlWithTitle ( ( < HTMLInputElement > this . getElementById ( 'issue-title' ) ) . value ) ;
@@ -967,15 +912,15 @@ export class IssueReporter extends Disposable {
967912 }
968913
969914 private getIssueUrlWithTitle ( issueTitle : string ) : string {
970- let repositoryUrl = product . reportIssueUrl ;
915+ let repositoryUrl = this . configuration . product . reportIssueUrl ;
971916 if ( this . issueReporterModel . fileOnExtension ( ) ) {
972917 const extensionGitHubUrl = this . getExtensionGitHubUrl ( ) ;
973918 if ( extensionGitHubUrl ) {
974919 repositoryUrl = extensionGitHubUrl + '/issues/new' ;
975920 }
976921 }
977922
978- const queryStringPrefix = product . reportIssueUrl && product . reportIssueUrl . indexOf ( '?' ) === - 1 ? '?' : '&' ;
923+ const queryStringPrefix = this . configuration . product . reportIssueUrl && this . configuration . product . reportIssueUrl . indexOf ( '?' ) === - 1 ? '?' : '&' ;
979924 return `${ repositoryUrl } ${ queryStringPrefix } title=${ encodeURIComponent ( issueTitle ) } ` ;
980925 }
981926
@@ -1136,7 +1081,7 @@ export class IssueReporter extends Disposable {
11361081 private updateExtensionTable ( extensions : IssueReporterExtensionData [ ] , numThemeExtensions : number ) : void {
11371082 const target = document . querySelector ( '.block-extensions .block-info' ) ;
11381083 if ( target ) {
1139- if ( this . environmentService . disableExtensions ) {
1084+ if ( this . configuration . disableExtensions ) {
11401085 target . innerHTML = localize ( 'disabledExtensions' , "Extensions are disabled" ) ;
11411086 return ;
11421087 }
@@ -1193,7 +1138,6 @@ export class IssueReporter extends Disposable {
11931138 // Exclude right click
11941139 if ( event . which < 3 ) {
11951140 windowOpenNoOpener ( ( < HTMLAnchorElement > event . target ) . href ) ;
1196- this . telemetryService . publicLog2 ( 'issueReporterViewSimilarIssue' ) ;
11971141 }
11981142 }
11991143
0 commit comments