@@ -20,7 +20,6 @@ import { normalizeGitHubUrl } from 'vs/platform/issue/common/issueReporterUtil';
20
20
import { INativeHostService } from 'vs/platform/native/common/native' ;
21
21
import { applyZoom , zoomIn , zoomOut } from 'vs/platform/window/electron-sandbox/window' ;
22
22
import { CancellationError } from 'vs/base/common/errors' ;
23
- import { CancellationToken , CancellationTokenSource } from 'vs/base/common/cancellation' ;
24
23
25
24
// GitHub has let us know that we could up our limit here to 8k. We chose 7500 to play it safe.
26
25
// ref https://github.com/microsoft/vscode/issues/159191
@@ -91,15 +90,15 @@ export class IssueReporter extends Disposable {
91
90
}
92
91
}
93
92
94
- this . issueMainService . getSystemInfo ( ) . then ( info => {
93
+ this . issueMainService . $ getSystemInfo( ) . then ( info => {
95
94
this . issueReporterModel . update ( { systemInfo : info } ) ;
96
95
this . receivedSystemInfo = true ;
97
96
98
97
this . updateSystemInfo ( this . issueReporterModel . getData ( ) ) ;
99
98
this . updatePreviewButtonState ( ) ;
100
99
} ) ;
101
100
if ( configuration . data . issueType === IssueType . PerformanceIssue ) {
102
- this . issueMainService . getPerformanceInfo ( ) . then ( info => {
101
+ this . issueMainService . $ getPerformanceInfo( ) . then ( info => {
103
102
this . updatePerformanceInfo ( info as Partial < IssueReporterData > ) ;
104
103
} ) ;
105
104
}
@@ -225,9 +224,9 @@ export class IssueReporter extends Disposable {
225
224
this . updateExtensionSelector ( installedExtensions ) ;
226
225
}
227
226
228
- private async updateIssueReporterUri ( extension : IssueReporterExtensionData , token : CancellationToken ) : Promise < void > {
227
+ private async updateIssueReporterUri ( extension : IssueReporterExtensionData ) : Promise < void > {
229
228
try {
230
- const uri = await this . issueMainService . getIssueReporterUri ( extension . id , token ) ;
229
+ const uri = await this . issueMainService . $ getIssueReporterUri( extension . id ) ;
231
230
extension . bugsUrl = uri . toString ( true ) ;
232
231
} catch ( e ) {
233
232
extension . hasIssueUriRequestHandler = false ;
@@ -241,7 +240,7 @@ export class IssueReporter extends Disposable {
241
240
const issueType = parseInt ( ( < HTMLInputElement > event . target ) . value ) ;
242
241
this . issueReporterModel . update ( { issueType : issueType } ) ;
243
242
if ( issueType === IssueType . PerformanceIssue && ! this . receivedPerformanceInfo ) {
244
- this . issueMainService . getPerformanceInfo ( ) . then ( info => {
243
+ this . issueMainService . $ getPerformanceInfo( ) . then ( info => {
245
244
this . updatePerformanceInfo ( info as Partial < IssueReporterData > ) ;
246
245
} ) ;
247
246
}
@@ -340,7 +339,7 @@ export class IssueReporter extends Disposable {
340
339
} ) ;
341
340
342
341
this . addEventListener ( 'disableExtensions' , 'click' , ( ) => {
343
- this . issueMainService . reloadWithExtensionsDisabled ( ) ;
342
+ this . issueMainService . $ reloadWithExtensionsDisabled( ) ;
344
343
} ) ;
345
344
346
345
this . addEventListener ( 'extensionBugsLink' , 'click' , ( e : Event ) => {
@@ -351,7 +350,7 @@ export class IssueReporter extends Disposable {
351
350
this . addEventListener ( 'disableExtensions' , 'keydown' , ( e : Event ) => {
352
351
e . stopPropagation ( ) ;
353
352
if ( ( e as KeyboardEvent ) . keyCode === 13 || ( e as KeyboardEvent ) . keyCode === 32 ) {
354
- this . issueMainService . reloadWithExtensionsDisabled ( ) ;
353
+ this . issueMainService . $ reloadWithExtensionsDisabled( ) ;
355
354
}
356
355
} ) ;
357
356
@@ -375,7 +374,7 @@ export class IssueReporter extends Disposable {
375
374
const { issueDescription } = this . issueReporterModel . getData ( ) ;
376
375
if ( ! this . hasBeenSubmitted && ( issueTitle || issueDescription ) ) {
377
376
// fire and forget
378
- this . issueMainService . showConfirmCloseDialog ( ) ;
377
+ this . issueMainService . $ showConfirmCloseDialog( ) ;
379
378
} else {
380
379
this . close ( ) ;
381
380
}
@@ -505,7 +504,7 @@ export class IssueReporter extends Disposable {
505
504
}
506
505
507
506
private async close ( ) : Promise < void > {
508
- await this . issueMainService . closeReporter ( ) ;
507
+ await this . issueMainService . $ closeReporter( ) ;
509
508
}
510
509
511
510
private clearSearchResults ( ) : void {
@@ -882,7 +881,7 @@ export class IssueReporter extends Disposable {
882
881
}
883
882
884
883
private async writeToClipboard ( baseUrl : string , issueBody : string ) : Promise < string > {
885
- const shouldWrite = await this . issueMainService . showClipboardDialog ( ) ;
884
+ const shouldWrite = await this . issueMainService . $ showClipboardDialog( ) ;
886
885
if ( ! shouldWrite ) {
887
886
throw new CancellationError ( ) ;
888
887
}
@@ -1058,23 +1057,19 @@ export class IssueReporter extends Disposable {
1058
1057
const { selectedExtension } = this . issueReporterModel . getData ( ) ;
1059
1058
reset ( extensionsSelector , $ < HTMLOptionElement > ( 'option' ) , ...extensionOptions . map ( extension => makeOption ( extension , selectedExtension ) ) ) ;
1060
1059
1061
- let tokenSource : CancellationTokenSource | undefined ;
1062
1060
this . addEventListener ( 'extension-selector' , 'change' , ( e : Event ) => {
1063
- tokenSource ?. cancel ( ) ;
1064
1061
const selectedExtensionId = ( < HTMLInputElement > e . target ) . value ;
1065
1062
const extensions = this . issueReporterModel . getData ( ) . allExtensions ;
1066
1063
const matches = extensions . filter ( extension => extension . id === selectedExtensionId ) ;
1067
1064
if ( matches . length ) {
1068
1065
this . issueReporterModel . update ( { selectedExtension : matches [ 0 ] } ) ;
1069
- this . validateSelectedExtension ( ) ;
1070
-
1071
1066
if ( matches [ 0 ] . hasIssueUriRequestHandler ) {
1072
- tokenSource = new CancellationTokenSource ( ) ;
1073
- this . updateIssueReporterUri ( matches [ 0 ] , tokenSource ?. token ) ;
1067
+ this . updateIssueReporterUri ( matches [ 0 ] ) ;
1068
+ } else {
1069
+ this . validateSelectedExtension ( ) ;
1070
+ const title = ( < HTMLInputElement > this . getElementById ( 'issue-title' ) ) . value ;
1071
+ this . searchExtensionIssues ( title ) ;
1074
1072
}
1075
-
1076
- const title = ( < HTMLInputElement > this . getElementById ( 'issue-title' ) ) . value ;
1077
- this . searchExtensionIssues ( title ) ;
1078
1073
} else {
1079
1074
this . issueReporterModel . update ( { selectedExtension : undefined } ) ;
1080
1075
this . clearSearchResults ( ) ;
@@ -1096,13 +1091,14 @@ export class IssueReporter extends Disposable {
1096
1091
hide ( extensionValidationMessage ) ;
1097
1092
hide ( extensionValidationNoUrlsMessage ) ;
1098
1093
1099
- if ( ! this . issueReporterModel . getData ( ) . selectedExtension ) {
1094
+ const extension = this . issueReporterModel . getData ( ) . selectedExtension ;
1095
+ if ( ! extension ) {
1100
1096
this . previewButton . enabled = true ;
1101
1097
return ;
1102
1098
}
1103
1099
1104
1100
const hasValidGitHubUrl = this . getExtensionGitHubUrl ( ) ;
1105
- if ( hasValidGitHubUrl ) {
1101
+ if ( hasValidGitHubUrl || extension . hasIssueUriRequestHandler ) {
1106
1102
this . previewButton . enabled = true ;
1107
1103
} else {
1108
1104
this . setExtensionValidationMessage ( ) ;
0 commit comments