Skip to content

Commit a35d42b

Browse files
authored
Issue reporter display fixes (microsoft#196485)
* Update issue reporter service to display extension data. * added fix for duplicate templating: * removes extension data when switching extensions:
1 parent cd6dc14 commit a35d42b

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

src/vs/code/electron-sandbox/issue/issueReporterPage.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const sendProcessInfoLabel = escape(localize('sendProcessInfo', "Include my curr
1111
const sendWorkspaceInfoLabel = escape(localize('sendWorkspaceInfo', "Include my workspace metadata"));
1212
const sendExtensionsLabel = escape(localize('sendExtensions', "Include my enabled extensions"));
1313
const sendExperimentsLabel = escape(localize('sendExperiments', "Include A/B experiment info"));
14-
const sendExtensionData = escape(localize('sendExtensionData', "Include Additional Extension info"));
14+
const sendExtensionData = escape(localize('sendExtensionData', "Include additional extension info"));
1515
const reviewGuidanceLabel = localize( // intentionally not escaped because of its embedded tags
1616
{
1717
key: 'reviewGuidanceLabel',
@@ -93,9 +93,9 @@ export default (): string => `
9393
<span id="ext-loading" hidden></span>
9494
<span class="ext-parens" hidden>(</span><a href="#" class="showInfo" id="extension-id">${escape(localize('show', "show"))}</a><span class="ext-parens" hidden>)</span>
9595
</label>
96-
<div class="block-info hidden">
97-
<textarea name="extension-data" id="extension-data" placeholder="${escape(localize('extensionData', "Extension does not have additional data to include."))}"></textarea>
98-
</div>
96+
<pre class="block-info" id="extension-data" placeholder="${escape(localize('extensionData', "Extension does not have additional data to include."))}">
97+
<!-- To be dynamically filled -->
98+
</pre>
9999
</div>
100100
101101
<div class="block block-system">

src/vs/code/electron-sandbox/issue/issueReporterService.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ export class IssueReporter extends Disposable {
257257
const data = await this.issueMainService.$getIssueReporterData(extension.id);
258258
extension.extensionData = data;
259259
this.receivedExtensionData = true;
260+
this.issueReporterModel.update({ extensionData: data });
260261
return data;
261262
} catch (e) {
262263
extension.hasIssueDataProviders = false;
@@ -785,11 +786,10 @@ export class IssueReporter extends Disposable {
785786
if (fileOnExtension && selectedExtension?.hasIssueDataProviders) {
786787
const data = this.getExtensionData();
787788
if (data) {
788-
(extensionDataTextArea as HTMLTextAreaElement).value = data.toString();
789+
(extensionDataTextArea as HTMLElement).innerText = data.toString();
789790
}
790791
(extensionDataTextArea as HTMLTextAreaElement).readOnly = true;
791792
show(extensionDataBlock);
792-
show(extensionDataTextArea);
793793
}
794794

795795
if (issueType === IssueType.Bug) {
@@ -1136,18 +1136,24 @@ export class IssueReporter extends Disposable {
11361136
} else if (matches[0].hasIssueDataProviders) {
11371137
const template = await this.getIssueTemplateFromExtension(matches[0]);
11381138
const descriptionTextArea = this.getElementById('description')!;
1139-
const fullTextArea = (descriptionTextArea as HTMLTextAreaElement).value += template;
1140-
this.issueReporterModel.update({ issueDescription: fullTextArea });
1141-
1139+
const descriptionText = (descriptionTextArea as HTMLTextAreaElement).value;
1140+
if (descriptionText === '' || !descriptionText.includes(template)) {
1141+
const fullTextArea = descriptionText + (descriptionText === '' ? '' : '\n') + template;
1142+
(descriptionTextArea as HTMLTextAreaElement).value = fullTextArea;
1143+
this.issueReporterModel.update({ issueDescription: fullTextArea });
1144+
}
11421145
const extensionDataBlock = document.querySelector('.block-extension-data')!;
11431146
show(extensionDataBlock);
11441147

11451148
// Start loading for extension data.
1146-
this.setLoading();
1149+
const iconElement = document.createElement('span');
1150+
iconElement.classList.add(...ThemeIcon.asClassNameArray(Codicon.loading), 'codicon-modifier-spin');
1151+
this.setLoading(iconElement);
11471152
await this.getIssueDataFromExtension(matches[0]);
1148-
this.removeLoading();
1153+
this.removeLoading(iconElement);
11491154
} else {
11501155
this.validateSelectedExtension();
1156+
this.issueReporterModel.update({ extensionData: undefined });
11511157
const title = (<HTMLInputElement>this.getElementById('issue-title')).value;
11521158
this.searchExtensionIssues(title);
11531159
}
@@ -1187,8 +1193,9 @@ export class IssueReporter extends Disposable {
11871193
}
11881194
}
11891195

1190-
private setLoading() {
1196+
private setLoading(element: HTMLElement) {
11911197
// Show loading
1198+
this.receivedExtensionData = false;
11921199
this.updatePreviewButtonState();
11931200

11941201
const extensionDataCaption = this.getElementById('extension-id')!;
@@ -1199,13 +1206,10 @@ export class IssueReporter extends Disposable {
11991206

12001207
const showLoading = this.getElementById('ext-loading')!;
12011208
show(showLoading);
1202-
1203-
const iconElement = document.createElement('span');
1204-
iconElement.classList.add(...ThemeIcon.asClassNameArray(Codicon.loading), 'codicon-modifier-spin');
1205-
showLoading.append(iconElement);
1209+
showLoading.append(element);
12061210
}
12071211

1208-
private removeLoading() {
1212+
private removeLoading(element: HTMLElement) {
12091213
this.updatePreviewButtonState();
12101214

12111215
const extensionDataCaption = this.getElementById('extension-id')!;
@@ -1216,6 +1220,7 @@ export class IssueReporter extends Disposable {
12161220

12171221
const hideLoading = this.getElementById('ext-loading')!;
12181222
hide(hideLoading);
1223+
hideLoading.removeChild(element);
12191224
}
12201225

12211226
private setExtensionValidationMessage(): void {

0 commit comments

Comments
 (0)