@codingame/monaco-vscode-issue-service-override 25.1.1 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/issue/browser/baseIssueReporterService.js +442 -396
- package/vscode/src/vs/workbench/contrib/issue/browser/issue.contribution.js +8 -11
- package/vscode/src/vs/workbench/contrib/issue/browser/issueFormService.js +73 -68
- package/vscode/src/vs/workbench/contrib/issue/browser/issueReporterModel.js +34 -38
- package/vscode/src/vs/workbench/contrib/issue/browser/issueReporterPage.js +148 -144
- package/vscode/src/vs/workbench/contrib/issue/browser/issueReporterService.js +40 -17
- package/vscode/src/vs/workbench/contrib/issue/browser/issueService.js +49 -47
- package/vscode/src/vs/workbench/contrib/issue/browser/issueTroubleshoot.js +100 -89
- package/vscode/src/vs/workbench/contrib/issue/browser/media/issueReporter.css +0 -6
- package/vscode/src/vs/workbench/contrib/issue/common/issue.contribution.js +49 -55
|
@@ -34,14 +34,28 @@ import { IAuthenticationService } from '@codingame/monaco-vscode-api/vscode/vs/w
|
|
|
34
34
|
const MAX_URL_LENGTH = 7500;
|
|
35
35
|
const MAX_EXTENSION_DATA_LENGTH = 60000;
|
|
36
36
|
var IssueSource;
|
|
37
|
-
(function
|
|
37
|
+
(function(IssueSource) {
|
|
38
38
|
IssueSource["VSCode"] = "vscode";
|
|
39
39
|
IssueSource["Extension"] = "extension";
|
|
40
40
|
IssueSource["Marketplace"] = "marketplace";
|
|
41
41
|
IssueSource["Unknown"] = "unknown";
|
|
42
42
|
})(IssueSource || (IssueSource = {}));
|
|
43
43
|
let BaseIssueReporterService = class BaseIssueReporterService extends Disposable {
|
|
44
|
-
constructor(
|
|
44
|
+
constructor(
|
|
45
|
+
disableExtensions,
|
|
46
|
+
data,
|
|
47
|
+
os,
|
|
48
|
+
product,
|
|
49
|
+
window,
|
|
50
|
+
isWeb,
|
|
51
|
+
issueFormService,
|
|
52
|
+
themeService,
|
|
53
|
+
fileService,
|
|
54
|
+
fileDialogService,
|
|
55
|
+
contextMenuService,
|
|
56
|
+
authenticationService,
|
|
57
|
+
openerService
|
|
58
|
+
) {
|
|
45
59
|
super();
|
|
46
60
|
this.disableExtensions = disableExtensions;
|
|
47
61
|
this.data = data;
|
|
@@ -63,18 +77,20 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
63
77
|
this.hasBeenSubmitted = false;
|
|
64
78
|
this.openReporter = false;
|
|
65
79
|
this.loadingExtensionData = false;
|
|
66
|
-
this.selectedExtension =
|
|
80
|
+
this.selectedExtension = "";
|
|
67
81
|
this.delayedSubmit = ( new Delayer(300));
|
|
68
82
|
this.nonGitHubIssueUrl = false;
|
|
69
83
|
this.needsUpdate = false;
|
|
70
84
|
this.acknowledged = false;
|
|
71
|
-
const targetExtension = data.extensionId ? data.enabledExtensions.find(
|
|
85
|
+
const targetExtension = data.extensionId ? data.enabledExtensions.find(
|
|
86
|
+
extension => extension.id.toLocaleLowerCase() === data.extensionId?.toLocaleLowerCase()
|
|
87
|
+
) : undefined;
|
|
72
88
|
this.issueReporterModel = ( new IssueReporterModel({
|
|
73
89
|
...data,
|
|
74
90
|
issueType: data.issueType || IssueType.Bug,
|
|
75
91
|
versionInfo: {
|
|
76
|
-
vscodeVersion: `${product.nameShort} ${!!product.darwinUniversalAssetId ? `${product.version} (Universal)` : product.version} (${product.commit ||
|
|
77
|
-
os: `${this.os.type} ${this.os.arch} ${this.os.release}${isLinuxSnap ?
|
|
92
|
+
vscodeVersion: `${product.nameShort} ${!!product.darwinUniversalAssetId ? `${product.version} (Universal)` : product.version} (${product.commit || "Commit unknown"}, ${product.date || "Date unknown"})`,
|
|
93
|
+
os: `${this.os.type} ${this.os.arch} ${this.os.release}${isLinuxSnap ? " snap" : ""}`
|
|
78
94
|
},
|
|
79
95
|
extensionsDisabled: !!this.disableExtensions,
|
|
80
96
|
fileOnExtension: data.extensionId ? !targetExtension?.isBuiltin : undefined,
|
|
@@ -82,14 +98,12 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
82
98
|
}));
|
|
83
99
|
this._register(this.authenticationService.onDidChangeSessions(async () => {
|
|
84
100
|
const previousAuthState = !!this.data.githubAccessToken;
|
|
85
|
-
let githubAccessToken =
|
|
101
|
+
let githubAccessToken = "";
|
|
86
102
|
try {
|
|
87
|
-
const githubSessions = await this.authenticationService.getSessions(
|
|
88
|
-
const potentialSessions = githubSessions.filter(session => session.scopes.includes(
|
|
103
|
+
const githubSessions = await this.authenticationService.getSessions("github");
|
|
104
|
+
const potentialSessions = githubSessions.filter(session => session.scopes.includes("repo"));
|
|
89
105
|
githubAccessToken = potentialSessions[0]?.accessToken;
|
|
90
|
-
}
|
|
91
|
-
catch (e) {
|
|
92
|
-
}
|
|
106
|
+
} catch (e) {}
|
|
93
107
|
this.data.githubAccessToken = githubAccessToken;
|
|
94
108
|
const currentAuthState = !!githubAccessToken;
|
|
95
109
|
if (previousAuthState !== currentAuthState) {
|
|
@@ -98,42 +112,47 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
98
112
|
}));
|
|
99
113
|
const fileOnMarketplace = data.issueSource === IssueSource.Marketplace;
|
|
100
114
|
const fileOnProduct = data.issueSource === IssueSource.VSCode;
|
|
101
|
-
this.issueReporterModel.update({
|
|
102
|
-
|
|
115
|
+
this.issueReporterModel.update({
|
|
116
|
+
fileOnMarketplace,
|
|
117
|
+
fileOnProduct
|
|
118
|
+
});
|
|
119
|
+
this.createAction = this._register(( new Action("issueReporter.create", ( localize(8716, "Create on GitHub")), undefined, true, async () => {
|
|
103
120
|
this.delayedSubmit.trigger(async () => {
|
|
104
121
|
this.createIssue(true);
|
|
105
122
|
});
|
|
106
123
|
})));
|
|
107
|
-
this.previewAction = this._register(( new Action(
|
|
124
|
+
this.previewAction = this._register(( new Action("issueReporter.preview", ( localize(8717, "Preview on GitHub")), undefined, true, async () => {
|
|
108
125
|
this.delayedSubmit.trigger(async () => {
|
|
109
126
|
this.createIssue(false);
|
|
110
127
|
});
|
|
111
128
|
})));
|
|
112
|
-
this.privateAction = this._register(( new Action(
|
|
129
|
+
this.privateAction = this._register(( new Action("issueReporter.privateCreate", ( localize(8718, "Create Internally")), undefined, true, async () => {
|
|
113
130
|
this.delayedSubmit.trigger(async () => {
|
|
114
131
|
this.createIssue(true, true);
|
|
115
132
|
});
|
|
116
133
|
})));
|
|
117
134
|
const issueTitle = data.issueTitle;
|
|
118
135
|
if (issueTitle) {
|
|
119
|
-
const issueTitleElement = this.getElementById(
|
|
136
|
+
const issueTitleElement = this.getElementById("issue-title");
|
|
120
137
|
if (issueTitleElement) {
|
|
121
138
|
issueTitleElement.value = issueTitle;
|
|
122
139
|
}
|
|
123
140
|
}
|
|
124
141
|
const issueBody = data.issueBody;
|
|
125
142
|
if (issueBody) {
|
|
126
|
-
const description = this.getElementById(
|
|
143
|
+
const description = this.getElementById("description");
|
|
127
144
|
if (description) {
|
|
128
145
|
description.value = issueBody;
|
|
129
|
-
this.issueReporterModel.update({
|
|
146
|
+
this.issueReporterModel.update({
|
|
147
|
+
issueDescription: issueBody
|
|
148
|
+
});
|
|
130
149
|
}
|
|
131
150
|
}
|
|
132
|
-
if (this.window.document.documentElement.lang !==
|
|
133
|
-
show(this.getElementById(
|
|
151
|
+
if (this.window.document.documentElement.lang !== "en") {
|
|
152
|
+
show(this.getElementById("english"));
|
|
134
153
|
}
|
|
135
154
|
const codiconStyleSheet = createStyleSheet();
|
|
136
|
-
codiconStyleSheet.id =
|
|
155
|
+
codiconStyleSheet.id = "codiconStyles";
|
|
137
156
|
const iconsStyleSheet = this._register(getIconsStyleSheet(this.themeService));
|
|
138
157
|
function updateAll() {
|
|
139
158
|
codiconStyleSheet.textContent = iconsStyleSheet.getCSS();
|
|
@@ -146,7 +165,7 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
146
165
|
if ((data.data || data.uri) && targetExtension) {
|
|
147
166
|
this.updateExtensionStatus(targetExtension);
|
|
148
167
|
}
|
|
149
|
-
const issueReporterElement = this.getElementById(
|
|
168
|
+
const issueReporterElement = this.getElementById("issue-reporter");
|
|
150
169
|
if (issueReporterElement) {
|
|
151
170
|
this.updateButtonStates();
|
|
152
171
|
}
|
|
@@ -155,43 +174,44 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
155
174
|
this.renderBlocks();
|
|
156
175
|
}
|
|
157
176
|
setInitialFocus() {
|
|
158
|
-
const {
|
|
177
|
+
const {
|
|
178
|
+
fileOnExtension
|
|
179
|
+
} = this.issueReporterModel.getData();
|
|
159
180
|
if (fileOnExtension) {
|
|
160
|
-
const issueTitle = this.window.document.getElementById(
|
|
181
|
+
const issueTitle = this.window.document.getElementById("issue-title");
|
|
161
182
|
issueTitle?.focus();
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const issueType = this.window.document.getElementById('issue-type');
|
|
183
|
+
} else {
|
|
184
|
+
const issueType = this.window.document.getElementById("issue-type");
|
|
165
185
|
issueType?.focus();
|
|
166
186
|
}
|
|
167
187
|
}
|
|
168
188
|
updateButtonStates() {
|
|
169
|
-
const issueReporterElement = this.getElementById(
|
|
189
|
+
const issueReporterElement = this.getElementById("issue-reporter");
|
|
170
190
|
if (!issueReporterElement) {
|
|
171
191
|
return;
|
|
172
192
|
}
|
|
173
|
-
let publicElements = this.getElementById(
|
|
193
|
+
let publicElements = this.getElementById("public-elements");
|
|
174
194
|
if (!publicElements) {
|
|
175
|
-
publicElements = createElement(
|
|
176
|
-
publicElements.id =
|
|
177
|
-
publicElements.classList.add(
|
|
195
|
+
publicElements = createElement("div");
|
|
196
|
+
publicElements.id = "public-elements";
|
|
197
|
+
publicElements.classList.add("public-elements");
|
|
178
198
|
issueReporterElement.appendChild(publicElements);
|
|
179
199
|
}
|
|
180
200
|
this.updatePublicGithubButton(publicElements);
|
|
181
201
|
this.updatePublicRepoLink(publicElements);
|
|
182
|
-
let internalElements = this.getElementById(
|
|
202
|
+
let internalElements = this.getElementById("internal-elements");
|
|
183
203
|
if (!internalElements) {
|
|
184
|
-
internalElements = createElement(
|
|
185
|
-
internalElements.id =
|
|
186
|
-
internalElements.classList.add(
|
|
187
|
-
internalElements.classList.add(
|
|
204
|
+
internalElements = createElement("div");
|
|
205
|
+
internalElements.id = "internal-elements";
|
|
206
|
+
internalElements.classList.add("internal-elements");
|
|
207
|
+
internalElements.classList.add("hidden");
|
|
188
208
|
issueReporterElement.appendChild(internalElements);
|
|
189
209
|
}
|
|
190
|
-
let filingRow = this.getElementById(
|
|
210
|
+
let filingRow = this.getElementById("internal-top-row");
|
|
191
211
|
if (!filingRow) {
|
|
192
|
-
filingRow = createElement(
|
|
193
|
-
filingRow.id =
|
|
194
|
-
filingRow.classList.add(
|
|
212
|
+
filingRow = createElement("div");
|
|
213
|
+
filingRow.id = "internal-top-row";
|
|
214
|
+
filingRow.classList.add("internal-top-row");
|
|
195
215
|
internalElements.appendChild(filingRow);
|
|
196
216
|
}
|
|
197
217
|
this.updateInternalFilingNote(filingRow);
|
|
@@ -199,17 +219,17 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
199
219
|
this.updateInternalElementsVisibility();
|
|
200
220
|
}
|
|
201
221
|
updateInternalFilingNote(container) {
|
|
202
|
-
let filingNote = this.getElementById(
|
|
222
|
+
let filingNote = this.getElementById("internal-preview-message");
|
|
203
223
|
if (!filingNote) {
|
|
204
|
-
filingNote = createElement(
|
|
205
|
-
filingNote.id =
|
|
206
|
-
filingNote.classList.add(
|
|
224
|
+
filingNote = createElement("span");
|
|
225
|
+
filingNote.id = "internal-preview-message";
|
|
226
|
+
filingNote.classList.add("internal-preview-message");
|
|
207
227
|
container.appendChild(filingNote);
|
|
208
228
|
}
|
|
209
|
-
filingNote.textContent = escape(( localize(
|
|
229
|
+
filingNote.textContent = escape(( localize(8719, "If your copilot debug logs contain private information:")));
|
|
210
230
|
}
|
|
211
231
|
updatePublicGithubButton(container) {
|
|
212
|
-
const issueReporterElement = this.getElementById(
|
|
232
|
+
const issueReporterElement = this.getElementById("issue-reporter");
|
|
213
233
|
if (!issueReporterElement) {
|
|
214
234
|
return;
|
|
215
235
|
}
|
|
@@ -218,10 +238,9 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
218
238
|
}
|
|
219
239
|
if (!this.acknowledged && this.needsUpdate) {
|
|
220
240
|
this.publicGithubButton = this._register(( new Button(container, unthemedButtonStyles)));
|
|
221
|
-
this.publicGithubButton.label = ( localize(
|
|
241
|
+
this.publicGithubButton.label = ( localize(8720, "Confirm Version Acknowledgement"));
|
|
222
242
|
this.publicGithubButton.enabled = false;
|
|
223
|
-
}
|
|
224
|
-
else if (this.data.githubAccessToken && this.isPreviewEnabled()) {
|
|
243
|
+
} else if (this.data.githubAccessToken && this.isPreviewEnabled()) {
|
|
225
244
|
this.publicGithubButton = this._register(( new ButtonWithDropdown(container, {
|
|
226
245
|
contextMenuProvider: this.contextMenuService,
|
|
227
246
|
actions: [this.previewAction],
|
|
@@ -231,63 +250,60 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
231
250
|
this._register(this.publicGithubButton.onDidClick(() => {
|
|
232
251
|
this.createAction.run();
|
|
233
252
|
}));
|
|
234
|
-
this.publicGithubButton.label = ( localize(
|
|
253
|
+
this.publicGithubButton.label = ( localize(8721, "Create on GitHub"));
|
|
235
254
|
this.publicGithubButton.enabled = true;
|
|
236
|
-
}
|
|
237
|
-
else if (this.data.githubAccessToken && !this.isPreviewEnabled()) {
|
|
255
|
+
} else if (this.data.githubAccessToken && !this.isPreviewEnabled()) {
|
|
238
256
|
this.publicGithubButton = this._register(( new Button(container, unthemedButtonStyles)));
|
|
239
257
|
this._register(this.publicGithubButton.onDidClick(() => {
|
|
240
258
|
this.createAction.run();
|
|
241
259
|
}));
|
|
242
|
-
this.publicGithubButton.label = ( localize(
|
|
260
|
+
this.publicGithubButton.label = ( localize(8721, "Create on GitHub"));
|
|
243
261
|
this.publicGithubButton.enabled = true;
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
262
|
+
} else {
|
|
246
263
|
this.publicGithubButton = this._register(( new Button(container, unthemedButtonStyles)));
|
|
247
264
|
this._register(this.publicGithubButton.onDidClick(() => {
|
|
248
265
|
this.previewAction.run();
|
|
249
266
|
}));
|
|
250
|
-
this.publicGithubButton.label = ( localize(
|
|
267
|
+
this.publicGithubButton.label = ( localize(8722, "Preview on GitHub"));
|
|
251
268
|
this.publicGithubButton.enabled = true;
|
|
252
269
|
}
|
|
253
|
-
const repoLink = this.getElementById(
|
|
270
|
+
const repoLink = this.getElementById("show-repo-name");
|
|
254
271
|
if (repoLink) {
|
|
255
272
|
container.insertBefore(this.publicGithubButton.element, repoLink);
|
|
256
273
|
}
|
|
257
274
|
}
|
|
258
275
|
updatePublicRepoLink(container) {
|
|
259
|
-
let issueRepoName = this.getElementById(
|
|
276
|
+
let issueRepoName = this.getElementById("show-repo-name");
|
|
260
277
|
if (!issueRepoName) {
|
|
261
|
-
issueRepoName = createElement(
|
|
262
|
-
issueRepoName.id =
|
|
263
|
-
issueRepoName.classList.add(
|
|
278
|
+
issueRepoName = createElement("a");
|
|
279
|
+
issueRepoName.id = "show-repo-name";
|
|
280
|
+
issueRepoName.classList.add("hidden");
|
|
264
281
|
container.appendChild(issueRepoName);
|
|
265
282
|
}
|
|
266
283
|
const selectedExtension = this.issueReporterModel.getData().selectedExtension;
|
|
267
284
|
if (selectedExtension && selectedExtension.uri) {
|
|
268
285
|
const urlString = ( URI.revive(selectedExtension.uri).toString());
|
|
269
286
|
issueRepoName.href = urlString;
|
|
270
|
-
issueRepoName.addEventListener(
|
|
271
|
-
issueRepoName.addEventListener(
|
|
287
|
+
issueRepoName.addEventListener("click", e => this.openLink(e));
|
|
288
|
+
issueRepoName.addEventListener("auxclick", e => this.openLink(e));
|
|
272
289
|
const gitHubInfo = this.parseGitHubUrl(urlString);
|
|
273
|
-
issueRepoName.textContent = gitHubInfo ? gitHubInfo.owner +
|
|
290
|
+
issueRepoName.textContent = gitHubInfo ? gitHubInfo.owner + "/" + gitHubInfo.repositoryName : urlString;
|
|
274
291
|
Object.assign(issueRepoName.style, {
|
|
275
|
-
alignSelf:
|
|
276
|
-
display:
|
|
277
|
-
fontSize:
|
|
278
|
-
padding:
|
|
279
|
-
textDecoration:
|
|
280
|
-
width:
|
|
292
|
+
alignSelf: "flex-end",
|
|
293
|
+
display: "block",
|
|
294
|
+
fontSize: "13px",
|
|
295
|
+
padding: "4px 0px",
|
|
296
|
+
textDecoration: "none",
|
|
297
|
+
width: "auto"
|
|
281
298
|
});
|
|
282
299
|
show(issueRepoName);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
issueRepoName.removeAttribute('style');
|
|
300
|
+
} else if (issueRepoName) {
|
|
301
|
+
issueRepoName.removeAttribute("style");
|
|
286
302
|
hide(issueRepoName);
|
|
287
303
|
}
|
|
288
304
|
}
|
|
289
305
|
updateInternalGithubButton(container) {
|
|
290
|
-
const issueReporterElement = this.getElementById(
|
|
306
|
+
const issueReporterElement = this.getElementById("issue-reporter");
|
|
291
307
|
if (!issueReporterElement) {
|
|
292
308
|
return;
|
|
293
309
|
}
|
|
@@ -299,28 +315,27 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
299
315
|
this._register(this.internalGithubButton.onDidClick(() => {
|
|
300
316
|
this.privateAction.run();
|
|
301
317
|
}));
|
|
302
|
-
this.internalGithubButton.element.id =
|
|
303
|
-
this.internalGithubButton.element.classList.add(
|
|
304
|
-
this.internalGithubButton.label = ( localize(
|
|
318
|
+
this.internalGithubButton.element.id = "internal-create-btn";
|
|
319
|
+
this.internalGithubButton.element.classList.add("internal-create-subtle");
|
|
320
|
+
this.internalGithubButton.label = ( localize(8723, "Create Internally"));
|
|
305
321
|
this.internalGithubButton.enabled = true;
|
|
306
322
|
this.internalGithubButton.setTitle(this.data.privateUri.path.slice(1));
|
|
307
323
|
}
|
|
308
324
|
}
|
|
309
325
|
updateInternalElementsVisibility() {
|
|
310
|
-
const container = this.getElementById(
|
|
326
|
+
const container = this.getElementById("internal-elements");
|
|
311
327
|
if (!container) {
|
|
312
328
|
return;
|
|
313
329
|
}
|
|
314
330
|
if (this.data.githubAccessToken && this.data.privateUri) {
|
|
315
331
|
show(container);
|
|
316
|
-
container.style.display =
|
|
332
|
+
container.style.display = "";
|
|
317
333
|
if (this.internalGithubButton) {
|
|
318
334
|
this.internalGithubButton.enabled = this.publicGithubButton?.enabled ?? false;
|
|
319
335
|
}
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
336
|
+
} else {
|
|
322
337
|
hide(container);
|
|
323
|
-
container.style.display =
|
|
338
|
+
container.style.display = "none";
|
|
324
339
|
}
|
|
325
340
|
}
|
|
326
341
|
async updateIssueReporterUri(extension) {
|
|
@@ -329,28 +344,34 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
329
344
|
const uri = URI.revive(extension.uri);
|
|
330
345
|
extension.bugsUrl = ( uri.toString());
|
|
331
346
|
}
|
|
332
|
-
}
|
|
333
|
-
catch (e) {
|
|
347
|
+
} catch (e) {
|
|
334
348
|
this.renderBlocks();
|
|
335
349
|
}
|
|
336
350
|
}
|
|
337
351
|
handleExtensionData(extensions) {
|
|
338
352
|
const installedExtensions = extensions.filter(x => !x.isBuiltin);
|
|
339
|
-
const {
|
|
340
|
-
|
|
353
|
+
const {
|
|
354
|
+
nonThemes,
|
|
355
|
+
themes
|
|
356
|
+
} = groupBy(installedExtensions, ext => {
|
|
357
|
+
return ext.isTheme ? "themes" : "nonThemes";
|
|
341
358
|
});
|
|
342
359
|
const numberOfThemeExtesions = (themes && themes.length) ?? 0;
|
|
343
|
-
this.issueReporterModel.update({
|
|
360
|
+
this.issueReporterModel.update({
|
|
361
|
+
numberOfThemeExtesions,
|
|
362
|
+
enabledNonThemeExtesions: nonThemes,
|
|
363
|
+
allExtensions: installedExtensions
|
|
364
|
+
});
|
|
344
365
|
this.updateExtensionTable(nonThemes ?? [], numberOfThemeExtesions);
|
|
345
366
|
if (this.disableExtensions || installedExtensions.length === 0) {
|
|
346
|
-
this.getElementById(
|
|
367
|
+
this.getElementById("disableExtensions").disabled = true;
|
|
347
368
|
}
|
|
348
369
|
this.updateExtensionSelector(installedExtensions);
|
|
349
370
|
}
|
|
350
371
|
updateExtensionSelector(extensions) {
|
|
351
372
|
const extensionOptions = ( extensions.map(extension => {
|
|
352
373
|
return {
|
|
353
|
-
name: extension.displayName || extension.name ||
|
|
374
|
+
name: extension.displayName || extension.name || "",
|
|
354
375
|
id: extension.id
|
|
355
376
|
};
|
|
356
377
|
}));
|
|
@@ -367,30 +388,34 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
367
388
|
});
|
|
368
389
|
const makeOption = (extension, selectedExtension) => {
|
|
369
390
|
const selected = selectedExtension && extension.id === selectedExtension.id;
|
|
370
|
-
return $(
|
|
371
|
-
|
|
372
|
-
|
|
391
|
+
return $("option", {
|
|
392
|
+
"value": extension.id,
|
|
393
|
+
"selected": selected || ""
|
|
373
394
|
}, extension.name);
|
|
374
395
|
};
|
|
375
|
-
const extensionsSelector = this.getElementById(
|
|
396
|
+
const extensionsSelector = this.getElementById("extension-selector");
|
|
376
397
|
if (extensionsSelector) {
|
|
377
|
-
const {
|
|
378
|
-
|
|
398
|
+
const {
|
|
399
|
+
selectedExtension
|
|
400
|
+
} = this.issueReporterModel.getData();
|
|
401
|
+
reset(extensionsSelector, this.makeOption("", ( localize(8724, "Select extension")), true), ...( extensionOptions.map(extension => makeOption(extension, selectedExtension))));
|
|
379
402
|
if (!selectedExtension) {
|
|
380
403
|
extensionsSelector.selectedIndex = 0;
|
|
381
404
|
}
|
|
382
|
-
this.addEventListener(
|
|
405
|
+
this.addEventListener("extension-selector", "change", async e => {
|
|
383
406
|
this.clearExtensionData();
|
|
384
407
|
const selectedExtensionId = e.target.value;
|
|
385
408
|
this.selectedExtension = selectedExtensionId;
|
|
386
409
|
const extensions = this.issueReporterModel.getData().allExtensions;
|
|
387
410
|
const matches = extensions.filter(extension => extension.id === selectedExtensionId);
|
|
388
411
|
if (matches.length) {
|
|
389
|
-
this.issueReporterModel.update({
|
|
412
|
+
this.issueReporterModel.update({
|
|
413
|
+
selectedExtension: matches[0]
|
|
414
|
+
});
|
|
390
415
|
const selectedExtension = this.issueReporterModel.getData().selectedExtension;
|
|
391
416
|
if (selectedExtension) {
|
|
392
|
-
const iconElement = createElement(
|
|
393
|
-
iconElement.classList.add(...ThemeIcon.asClassNameArray(Codicon.loading),
|
|
417
|
+
const iconElement = createElement("span");
|
|
418
|
+
iconElement.classList.add(...ThemeIcon.asClassNameArray(Codicon.loading), "codicon-modifier-spin");
|
|
394
419
|
this.setLoading(iconElement);
|
|
395
420
|
const openReporterData = await this.sendReporterMenu(selectedExtension);
|
|
396
421
|
if (openReporterData) {
|
|
@@ -398,10 +423,9 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
398
423
|
this.removeLoading(iconElement, true);
|
|
399
424
|
this.data = openReporterData;
|
|
400
425
|
}
|
|
401
|
-
}
|
|
402
|
-
else {
|
|
426
|
+
} else {
|
|
403
427
|
if (!this.loadingExtensionData) {
|
|
404
|
-
iconElement.classList.remove(...ThemeIcon.asClassNameArray(Codicon.loading),
|
|
428
|
+
iconElement.classList.remove(...ThemeIcon.asClassNameArray(Codicon.loading), "codicon-modifier-spin");
|
|
405
429
|
}
|
|
406
430
|
this.removeLoading(iconElement);
|
|
407
431
|
this.clearExtensionData();
|
|
@@ -412,9 +436,10 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
412
436
|
this.updateExtensionStatus(matches[0]);
|
|
413
437
|
this.openReporter = false;
|
|
414
438
|
}
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
|
|
439
|
+
} else {
|
|
440
|
+
this.issueReporterModel.update({
|
|
441
|
+
selectedExtension: undefined
|
|
442
|
+
});
|
|
418
443
|
this.clearSearchResults();
|
|
419
444
|
this.clearExtensionData();
|
|
420
445
|
this.validateSelectedExtension();
|
|
@@ -424,181 +449,192 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
424
449
|
this.updateInternalElementsVisibility();
|
|
425
450
|
});
|
|
426
451
|
}
|
|
427
|
-
this.addEventListener(
|
|
452
|
+
this.addEventListener("problem-source", "change", _ => {
|
|
428
453
|
this.clearExtensionData();
|
|
429
454
|
this.validateSelectedExtension();
|
|
430
455
|
});
|
|
431
456
|
}
|
|
432
457
|
async sendReporterMenu(extension) {
|
|
433
458
|
try {
|
|
434
|
-
const timeoutPromise = ( new Promise((_, reject) => setTimeout(() => reject(( new Error(
|
|
435
|
-
const data = await Promise.race([
|
|
436
|
-
this.issueFormService.sendReporterMenu(extension.id),
|
|
437
|
-
timeoutPromise
|
|
438
|
-
]);
|
|
459
|
+
const timeoutPromise = ( new Promise((_, reject) => setTimeout(() => reject(( new Error("sendReporterMenu timed out"))), 10000)));
|
|
460
|
+
const data = await Promise.race([this.issueFormService.sendReporterMenu(extension.id), timeoutPromise]);
|
|
439
461
|
return data;
|
|
440
|
-
}
|
|
441
|
-
catch (e) {
|
|
462
|
+
} catch (e) {
|
|
442
463
|
console.error(e);
|
|
443
464
|
return undefined;
|
|
444
465
|
}
|
|
445
466
|
}
|
|
446
467
|
updateAcknowledgementState() {
|
|
447
|
-
const acknowledgementCheckbox = this.getElementById(
|
|
468
|
+
const acknowledgementCheckbox = this.getElementById("includeAcknowledgement");
|
|
448
469
|
if (acknowledgementCheckbox) {
|
|
449
470
|
this.acknowledged = acknowledgementCheckbox.checked;
|
|
450
471
|
this.updateButtonStates();
|
|
451
472
|
}
|
|
452
473
|
}
|
|
453
474
|
setEventHandlers() {
|
|
454
|
-
[
|
|
455
|
-
|
|
475
|
+
[
|
|
476
|
+
"includeSystemInfo",
|
|
477
|
+
"includeProcessInfo",
|
|
478
|
+
"includeWorkspaceInfo",
|
|
479
|
+
"includeExtensions",
|
|
480
|
+
"includeExperiments",
|
|
481
|
+
"includeExtensionData"
|
|
482
|
+
].forEach(elementId => {
|
|
483
|
+
this.addEventListener(elementId, "click", event => {
|
|
456
484
|
event.stopPropagation();
|
|
457
|
-
this.issueReporterModel.update({
|
|
485
|
+
this.issueReporterModel.update({
|
|
486
|
+
[elementId]: !this.issueReporterModel.getData()[elementId]
|
|
487
|
+
});
|
|
458
488
|
});
|
|
459
489
|
});
|
|
460
|
-
this.addEventListener(
|
|
490
|
+
this.addEventListener("includeAcknowledgement", "click", event => {
|
|
461
491
|
event.stopPropagation();
|
|
462
492
|
this.updateAcknowledgementState();
|
|
463
493
|
});
|
|
464
|
-
const showInfoElements = this.window.document.getElementsByClassName(
|
|
494
|
+
const showInfoElements = this.window.document.getElementsByClassName("showInfo");
|
|
465
495
|
for (let i = 0; i < showInfoElements.length; i++) {
|
|
466
496
|
const showInfo = showInfoElements.item(i);
|
|
467
|
-
showInfo.addEventListener(
|
|
497
|
+
showInfo.addEventListener("click", e => {
|
|
468
498
|
e.preventDefault();
|
|
469
499
|
const label = e.target;
|
|
470
500
|
if (label) {
|
|
471
501
|
const containingElement = label.parentElement && label.parentElement.parentElement;
|
|
472
502
|
const info = containingElement && containingElement.lastElementChild;
|
|
473
|
-
if (info && info.classList.contains(
|
|
503
|
+
if (info && info.classList.contains("hidden")) {
|
|
474
504
|
show(info);
|
|
475
|
-
label.textContent = ( localize(
|
|
476
|
-
}
|
|
477
|
-
else {
|
|
505
|
+
label.textContent = ( localize(8725, "hide"));
|
|
506
|
+
} else {
|
|
478
507
|
hide(info);
|
|
479
|
-
label.textContent = ( localize(
|
|
508
|
+
label.textContent = ( localize(8726, "show"));
|
|
480
509
|
}
|
|
481
510
|
}
|
|
482
511
|
});
|
|
483
512
|
}
|
|
484
|
-
this.addEventListener(
|
|
513
|
+
this.addEventListener("issue-source", "change", e => {
|
|
485
514
|
const value = e.target.value;
|
|
486
|
-
const problemSourceHelpText = this.getElementById(
|
|
487
|
-
if (value ===
|
|
488
|
-
this.issueReporterModel.update({
|
|
515
|
+
const problemSourceHelpText = this.getElementById("problem-source-help-text");
|
|
516
|
+
if (value === "") {
|
|
517
|
+
this.issueReporterModel.update({
|
|
518
|
+
fileOnExtension: undefined
|
|
519
|
+
});
|
|
489
520
|
show(problemSourceHelpText);
|
|
490
521
|
this.clearSearchResults();
|
|
491
522
|
this.render();
|
|
492
523
|
return;
|
|
493
|
-
}
|
|
494
|
-
else {
|
|
524
|
+
} else {
|
|
495
525
|
hide(problemSourceHelpText);
|
|
496
526
|
}
|
|
497
|
-
const descriptionTextArea = this.getElementById(
|
|
527
|
+
const descriptionTextArea = this.getElementById("issue-title");
|
|
498
528
|
if (value === IssueSource.VSCode) {
|
|
499
|
-
descriptionTextArea.placeholder = ( localize(
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
else
|
|
505
|
-
descriptionTextArea.placeholder = ( localize(
|
|
506
|
-
}
|
|
507
|
-
else {
|
|
508
|
-
descriptionTextArea.placeholder = ( localize(8423, "Please enter a title"));
|
|
529
|
+
descriptionTextArea.placeholder = ( localize(8727, "E.g Workbench is missing problems panel"));
|
|
530
|
+
} else if (value === IssueSource.Extension) {
|
|
531
|
+
descriptionTextArea.placeholder = ( localize(8728, "E.g. Missing alt text on extension readme image"));
|
|
532
|
+
} else if (value === IssueSource.Marketplace) {
|
|
533
|
+
descriptionTextArea.placeholder = ( localize(8729, "E.g Cannot disable installed extension"));
|
|
534
|
+
} else {
|
|
535
|
+
descriptionTextArea.placeholder = ( localize(8730, "Please enter a title"));
|
|
509
536
|
}
|
|
510
537
|
let fileOnExtension, fileOnMarketplace, fileOnProduct = false;
|
|
511
538
|
if (value === IssueSource.Extension) {
|
|
512
539
|
fileOnExtension = true;
|
|
513
|
-
}
|
|
514
|
-
else if (value === IssueSource.Marketplace) {
|
|
540
|
+
} else if (value === IssueSource.Marketplace) {
|
|
515
541
|
fileOnMarketplace = true;
|
|
516
|
-
}
|
|
517
|
-
else if (value === IssueSource.VSCode) {
|
|
542
|
+
} else if (value === IssueSource.VSCode) {
|
|
518
543
|
fileOnProduct = true;
|
|
519
544
|
}
|
|
520
|
-
this.issueReporterModel.update({
|
|
545
|
+
this.issueReporterModel.update({
|
|
546
|
+
fileOnExtension,
|
|
547
|
+
fileOnMarketplace,
|
|
548
|
+
fileOnProduct
|
|
549
|
+
});
|
|
521
550
|
this.render();
|
|
522
|
-
const title = this.getElementById(
|
|
551
|
+
const title = this.getElementById("issue-title").value;
|
|
523
552
|
this.searchIssues(title, fileOnExtension, fileOnMarketplace);
|
|
524
553
|
});
|
|
525
|
-
this.addEventListener(
|
|
554
|
+
this.addEventListener("description", "input", e => {
|
|
526
555
|
const issueDescription = e.target.value;
|
|
527
|
-
this.issueReporterModel.update({
|
|
556
|
+
this.issueReporterModel.update({
|
|
557
|
+
issueDescription
|
|
558
|
+
});
|
|
528
559
|
if (this.issueReporterModel.fileOnExtension() === false) {
|
|
529
|
-
const title = this.getElementById(
|
|
560
|
+
const title = this.getElementById("issue-title").value;
|
|
530
561
|
this.searchVSCodeIssues(title, issueDescription);
|
|
531
562
|
}
|
|
532
563
|
});
|
|
533
|
-
this.addEventListener(
|
|
534
|
-
const titleElement = this.getElementById(
|
|
564
|
+
this.addEventListener("issue-title", "input", _ => {
|
|
565
|
+
const titleElement = this.getElementById("issue-title");
|
|
535
566
|
if (titleElement) {
|
|
536
567
|
const title = titleElement.value;
|
|
537
|
-
this.issueReporterModel.update({
|
|
568
|
+
this.issueReporterModel.update({
|
|
569
|
+
issueTitle: title
|
|
570
|
+
});
|
|
538
571
|
}
|
|
539
572
|
});
|
|
540
|
-
this.addEventListener(
|
|
573
|
+
this.addEventListener("issue-title", "input", e => {
|
|
541
574
|
const title = e.target.value;
|
|
542
|
-
const lengthValidationMessage = this.getElementById(
|
|
575
|
+
const lengthValidationMessage = this.getElementById("issue-title-length-validation-error");
|
|
543
576
|
const issueUrl = this.getIssueUrl();
|
|
544
577
|
if (title && this.getIssueUrlWithTitle(title, issueUrl).length > MAX_URL_LENGTH) {
|
|
545
578
|
show(lengthValidationMessage);
|
|
546
|
-
}
|
|
547
|
-
else {
|
|
579
|
+
} else {
|
|
548
580
|
hide(lengthValidationMessage);
|
|
549
581
|
}
|
|
550
|
-
const issueSource = this.getElementById(
|
|
551
|
-
if (!issueSource || issueSource.value ===
|
|
582
|
+
const issueSource = this.getElementById("issue-source");
|
|
583
|
+
if (!issueSource || issueSource.value === "") {
|
|
552
584
|
return;
|
|
553
585
|
}
|
|
554
|
-
const {
|
|
586
|
+
const {
|
|
587
|
+
fileOnExtension,
|
|
588
|
+
fileOnMarketplace
|
|
589
|
+
} = this.issueReporterModel.getData();
|
|
555
590
|
this.searchIssues(title, fileOnExtension, fileOnMarketplace);
|
|
556
591
|
});
|
|
557
|
-
this.addEventListener(
|
|
592
|
+
this.addEventListener("disableExtensions", "click", () => {
|
|
558
593
|
this.issueFormService.reloadWithExtensionsDisabled();
|
|
559
594
|
});
|
|
560
|
-
this.addEventListener(
|
|
595
|
+
this.addEventListener("extensionBugsLink", "click", e => {
|
|
561
596
|
const url = e.target.innerText;
|
|
562
597
|
this.openLink(url);
|
|
563
598
|
});
|
|
564
|
-
this.addEventListener(
|
|
599
|
+
this.addEventListener("disableExtensions", "keydown", e => {
|
|
565
600
|
e.stopPropagation();
|
|
566
|
-
if (e.key ===
|
|
601
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
567
602
|
this.issueFormService.reloadWithExtensionsDisabled();
|
|
568
603
|
}
|
|
569
604
|
});
|
|
570
|
-
this.window.document.onkeydown = async
|
|
605
|
+
this.window.document.onkeydown = async e => {
|
|
571
606
|
const cmdOrCtrlKey = isMacintosh ? e.metaKey : e.ctrlKey;
|
|
572
|
-
if (cmdOrCtrlKey && e.key ===
|
|
607
|
+
if (cmdOrCtrlKey && e.key === "Enter") {
|
|
573
608
|
this.delayedSubmit.trigger(async () => {
|
|
574
609
|
if (await this.createIssue()) {
|
|
575
610
|
this.close();
|
|
576
611
|
}
|
|
577
612
|
});
|
|
578
613
|
}
|
|
579
|
-
if (cmdOrCtrlKey && e.key ===
|
|
614
|
+
if (cmdOrCtrlKey && e.key === "w") {
|
|
580
615
|
e.stopPropagation();
|
|
581
616
|
e.preventDefault();
|
|
582
|
-
const issueTitle = this.getElementById(
|
|
583
|
-
const {
|
|
617
|
+
const issueTitle = this.getElementById("issue-title").value;
|
|
618
|
+
const {
|
|
619
|
+
issueDescription
|
|
620
|
+
} = this.issueReporterModel.getData();
|
|
584
621
|
if (!this.hasBeenSubmitted && (issueTitle || issueDescription)) {
|
|
585
622
|
this.issueFormService.showConfirmCloseDialog();
|
|
586
|
-
}
|
|
587
|
-
else {
|
|
623
|
+
} else {
|
|
588
624
|
this.close();
|
|
589
625
|
}
|
|
590
626
|
}
|
|
591
627
|
if (isMacintosh) {
|
|
592
|
-
if (cmdOrCtrlKey && e.key ===
|
|
628
|
+
if (cmdOrCtrlKey && e.key === "a" && e.target) {
|
|
593
629
|
if (isHTMLInputElement(e.target) || isHTMLTextAreaElement(e.target)) {
|
|
594
630
|
e.target.select();
|
|
595
631
|
}
|
|
596
632
|
}
|
|
597
633
|
}
|
|
598
634
|
};
|
|
599
|
-
this.addEventListener(
|
|
635
|
+
this.addEventListener("review-guidance-help-text", "click", e => {
|
|
600
636
|
const target = e.target;
|
|
601
|
-
if (target.tagName ===
|
|
637
|
+
if (target.tagName === "A" && target.getAttribute("target") === "_blank") {
|
|
602
638
|
this.openLink(e);
|
|
603
639
|
}
|
|
604
640
|
});
|
|
@@ -620,8 +656,7 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
620
656
|
if (issueType === IssueType.FeatureRequest || issueType === IssueType.PerformanceIssue || issueType === IssueType.Bug) {
|
|
621
657
|
return true;
|
|
622
658
|
}
|
|
623
|
-
}
|
|
624
|
-
else {
|
|
659
|
+
} else {
|
|
625
660
|
if (issueType === IssueType.Bug && this.receivedSystemInfo) {
|
|
626
661
|
return true;
|
|
627
662
|
}
|
|
@@ -645,8 +680,7 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
645
680
|
searchVSCodeIssues(title, issueDescription) {
|
|
646
681
|
if (title) {
|
|
647
682
|
this.searchDuplicates(title, issueDescription);
|
|
648
|
-
}
|
|
649
|
-
else {
|
|
683
|
+
} else {
|
|
650
684
|
this.clearSearchResults();
|
|
651
685
|
}
|
|
652
686
|
}
|
|
@@ -687,81 +721,81 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
687
721
|
await this.issueFormService.closeReporter();
|
|
688
722
|
}
|
|
689
723
|
clearSearchResults() {
|
|
690
|
-
const similarIssues = this.getElementById(
|
|
691
|
-
similarIssues.innerText =
|
|
724
|
+
const similarIssues = this.getElementById("similar-issues");
|
|
725
|
+
similarIssues.innerText = "";
|
|
692
726
|
this.numberOfSearchResultsDisplayed = 0;
|
|
693
727
|
}
|
|
694
728
|
searchGitHub(repo, title) {
|
|
695
729
|
const query = `is:issue+repo:${repo}+${title}`;
|
|
696
|
-
const similarIssues = this.getElementById(
|
|
697
|
-
fetch(`https://api.github.com/search/issues?q=${query}`).then(
|
|
730
|
+
const similarIssues = this.getElementById("similar-issues");
|
|
731
|
+
fetch(`https://api.github.com/search/issues?q=${query}`).then(response => {
|
|
698
732
|
response.json().then(result => {
|
|
699
|
-
similarIssues.innerText =
|
|
733
|
+
similarIssues.innerText = "";
|
|
700
734
|
if (result && result.items) {
|
|
701
735
|
this.displaySearchResults(result.items);
|
|
702
736
|
}
|
|
703
737
|
}).catch(_ => {
|
|
704
|
-
console.warn(
|
|
738
|
+
console.warn("Timeout or query limit exceeded");
|
|
705
739
|
});
|
|
706
740
|
}).catch(_ => {
|
|
707
|
-
console.warn(
|
|
741
|
+
console.warn("Error fetching GitHub issues");
|
|
708
742
|
});
|
|
709
743
|
}
|
|
710
744
|
searchDuplicates(title, body) {
|
|
711
|
-
const url =
|
|
745
|
+
const url = "https://vscode-probot.westus.cloudapp.azure.com:7890/duplicate_candidates";
|
|
712
746
|
const init = {
|
|
713
|
-
method:
|
|
747
|
+
method: "POST",
|
|
714
748
|
body: JSON.stringify({
|
|
715
749
|
title,
|
|
716
750
|
body
|
|
717
751
|
}),
|
|
718
752
|
headers: ( new Headers({
|
|
719
|
-
|
|
753
|
+
"Content-Type": "application/json"
|
|
720
754
|
}))
|
|
721
755
|
};
|
|
722
|
-
fetch(url, init).then(
|
|
756
|
+
fetch(url, init).then(response => {
|
|
723
757
|
response.json().then(result => {
|
|
724
758
|
this.clearSearchResults();
|
|
725
759
|
if (result && result.candidates) {
|
|
726
760
|
this.displaySearchResults(result.candidates);
|
|
761
|
+
} else {
|
|
762
|
+
throw ( new Error("Unexpected response, no candidates property"));
|
|
727
763
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
}
|
|
731
|
-
}).catch(_ => {
|
|
732
|
-
});
|
|
733
|
-
}).catch(_ => {
|
|
734
|
-
});
|
|
764
|
+
}).catch(_ => {});
|
|
765
|
+
}).catch(_ => {});
|
|
735
766
|
}
|
|
736
767
|
displaySearchResults(results) {
|
|
737
|
-
const similarIssues = this.getElementById(
|
|
768
|
+
const similarIssues = this.getElementById("similar-issues");
|
|
738
769
|
if (results.length) {
|
|
739
|
-
const issues = $(
|
|
740
|
-
const issuesText = $(
|
|
741
|
-
issuesText.textContent = ( localize(
|
|
770
|
+
const issues = $("div.issues-container");
|
|
771
|
+
const issuesText = $("div.list-title");
|
|
772
|
+
issuesText.textContent = ( localize(8731, "Similar issues"));
|
|
742
773
|
this.numberOfSearchResultsDisplayed = results.length < 5 ? results.length : 5;
|
|
743
774
|
for (let i = 0; i < this.numberOfSearchResultsDisplayed; i++) {
|
|
744
775
|
const issue = results[i];
|
|
745
|
-
const link = $(
|
|
776
|
+
const link = $("a.issue-link", {
|
|
777
|
+
href: issue.html_url
|
|
778
|
+
});
|
|
746
779
|
link.textContent = issue.title;
|
|
747
780
|
link.title = issue.title;
|
|
748
|
-
link.addEventListener(
|
|
749
|
-
link.addEventListener(
|
|
781
|
+
link.addEventListener("click", e => this.openLink(e));
|
|
782
|
+
link.addEventListener("auxclick", e => this.openLink(e));
|
|
750
783
|
let issueState;
|
|
751
784
|
let item;
|
|
752
785
|
if (issue.state) {
|
|
753
|
-
issueState = $(
|
|
754
|
-
const issueIcon = $(
|
|
755
|
-
issueIcon.appendChild(
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
786
|
+
issueState = $("span.issue-state");
|
|
787
|
+
const issueIcon = $("span.issue-icon");
|
|
788
|
+
issueIcon.appendChild(
|
|
789
|
+
renderIcon(issue.state === "open" ? Codicon.issueOpened : Codicon.issueClosed)
|
|
790
|
+
);
|
|
791
|
+
const issueStateLabel = $("span.issue-state.label");
|
|
792
|
+
issueStateLabel.textContent = issue.state === "open" ? ( localize(8732, "Open")) : ( localize(8733, "Closed"));
|
|
793
|
+
issueState.title = issue.state === "open" ? ( localize(8732, "Open")) : ( localize(8733, "Closed"));
|
|
759
794
|
issueState.appendChild(issueIcon);
|
|
760
795
|
issueState.appendChild(issueStateLabel);
|
|
761
|
-
item = $(
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
item = $('div.issue', undefined, link);
|
|
796
|
+
item = $("div.issue", undefined, issueState, link);
|
|
797
|
+
} else {
|
|
798
|
+
item = $("div.issue", undefined, link);
|
|
765
799
|
}
|
|
766
800
|
issues.appendChild(item);
|
|
767
801
|
}
|
|
@@ -770,73 +804,84 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
770
804
|
}
|
|
771
805
|
}
|
|
772
806
|
setUpTypes() {
|
|
773
|
-
const makeOption = (issueType, description) => $(
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
807
|
+
const makeOption = (issueType, description) => $("option", {
|
|
808
|
+
"value": issueType.valueOf()
|
|
809
|
+
}, escape(description));
|
|
810
|
+
const typeSelect = this.getElementById("issue-type");
|
|
811
|
+
const {
|
|
812
|
+
issueType
|
|
813
|
+
} = this.issueReporterModel.getData();
|
|
814
|
+
reset(typeSelect, makeOption(IssueType.Bug, ( localize(8734, "Bug Report"))), makeOption(IssueType.FeatureRequest, ( localize(8735, "Feature Request"))), makeOption(IssueType.PerformanceIssue, ( localize(8736, "Performance Issue (freeze, slow, crash)"))));
|
|
777
815
|
typeSelect.value = ( issueType.toString());
|
|
778
816
|
this.setSourceOptions();
|
|
779
817
|
}
|
|
780
818
|
makeOption(value, description, disabled) {
|
|
781
|
-
const option = createElement(
|
|
819
|
+
const option = createElement("option");
|
|
782
820
|
option.disabled = disabled;
|
|
783
821
|
option.value = value;
|
|
784
822
|
option.textContent = description;
|
|
785
823
|
return option;
|
|
786
824
|
}
|
|
787
825
|
setSourceOptions() {
|
|
788
|
-
const sourceSelect = this.getElementById(
|
|
789
|
-
const {
|
|
826
|
+
const sourceSelect = this.getElementById("issue-source");
|
|
827
|
+
const {
|
|
828
|
+
issueType,
|
|
829
|
+
fileOnExtension,
|
|
830
|
+
selectedExtension,
|
|
831
|
+
fileOnMarketplace,
|
|
832
|
+
fileOnProduct
|
|
833
|
+
} = this.issueReporterModel.getData();
|
|
790
834
|
let selected = sourceSelect.selectedIndex;
|
|
791
835
|
if (selected === -1) {
|
|
792
836
|
if (fileOnExtension !== undefined) {
|
|
793
837
|
selected = fileOnExtension ? 2 : 1;
|
|
794
|
-
}
|
|
795
|
-
else if (selectedExtension?.isBuiltin) {
|
|
838
|
+
} else if (selectedExtension?.isBuiltin) {
|
|
796
839
|
selected = 1;
|
|
797
|
-
}
|
|
798
|
-
else if (fileOnMarketplace) {
|
|
840
|
+
} else if (fileOnMarketplace) {
|
|
799
841
|
selected = 3;
|
|
800
|
-
}
|
|
801
|
-
else if (fileOnProduct) {
|
|
842
|
+
} else if (fileOnProduct) {
|
|
802
843
|
selected = 1;
|
|
803
844
|
}
|
|
804
845
|
}
|
|
805
|
-
sourceSelect.innerText =
|
|
806
|
-
sourceSelect.append(this.makeOption(
|
|
807
|
-
sourceSelect.append(this.makeOption(IssueSource.VSCode, ( localize(
|
|
808
|
-
sourceSelect.append(this.makeOption(IssueSource.Extension, ( localize(
|
|
846
|
+
sourceSelect.innerText = "";
|
|
847
|
+
sourceSelect.append(this.makeOption("", ( localize(8737, "Select source")), true));
|
|
848
|
+
sourceSelect.append(this.makeOption(IssueSource.VSCode, ( localize(8738, "Visual Studio Code")), false));
|
|
849
|
+
sourceSelect.append(this.makeOption(IssueSource.Extension, ( localize(8739, "A VS Code extension")), false));
|
|
809
850
|
if (this.product.reportMarketplaceIssueUrl) {
|
|
810
|
-
sourceSelect.append(this.makeOption(IssueSource.Marketplace, ( localize(
|
|
851
|
+
sourceSelect.append(this.makeOption(IssueSource.Marketplace, ( localize(8740, "Extensions Marketplace")), false));
|
|
811
852
|
}
|
|
812
853
|
if (issueType !== IssueType.FeatureRequest) {
|
|
813
|
-
sourceSelect.append(this.makeOption(IssueSource.Unknown, ( localize(
|
|
854
|
+
sourceSelect.append(this.makeOption(IssueSource.Unknown, ( localize(8741, "Don't know")), false));
|
|
814
855
|
}
|
|
815
856
|
if (selected !== -1 && selected < sourceSelect.options.length) {
|
|
816
857
|
sourceSelect.selectedIndex = selected;
|
|
817
|
-
}
|
|
818
|
-
else {
|
|
858
|
+
} else {
|
|
819
859
|
sourceSelect.selectedIndex = 0;
|
|
820
|
-
hide(this.getElementById(
|
|
860
|
+
hide(this.getElementById("problem-source-help-text"));
|
|
821
861
|
}
|
|
822
862
|
}
|
|
823
863
|
async renderBlocks() {
|
|
824
|
-
const {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
const
|
|
831
|
-
const
|
|
832
|
-
const
|
|
833
|
-
const
|
|
834
|
-
const
|
|
835
|
-
const
|
|
836
|
-
const
|
|
837
|
-
const
|
|
838
|
-
const
|
|
839
|
-
const
|
|
864
|
+
const {
|
|
865
|
+
issueType,
|
|
866
|
+
fileOnExtension,
|
|
867
|
+
fileOnMarketplace,
|
|
868
|
+
selectedExtension
|
|
869
|
+
} = this.issueReporterModel.getData();
|
|
870
|
+
const blockContainer = this.getElementById("block-container");
|
|
871
|
+
const systemBlock = this.window.document.querySelector(".block-system");
|
|
872
|
+
const processBlock = this.window.document.querySelector(".block-process");
|
|
873
|
+
const workspaceBlock = this.window.document.querySelector(".block-workspace");
|
|
874
|
+
const extensionsBlock = this.window.document.querySelector(".block-extensions");
|
|
875
|
+
const experimentsBlock = this.window.document.querySelector(".block-experiments");
|
|
876
|
+
const extensionDataBlock = this.window.document.querySelector(".block-extension-data");
|
|
877
|
+
const problemSource = this.getElementById("problem-source");
|
|
878
|
+
const descriptionTitle = this.getElementById("issue-description-label");
|
|
879
|
+
const descriptionSubtitle = this.getElementById("issue-description-subtitle");
|
|
880
|
+
const extensionSelector = this.getElementById("extension-selection");
|
|
881
|
+
const downloadExtensionDataLink = this.getElementById("extension-data-download");
|
|
882
|
+
const titleTextArea = this.getElementById("issue-title-container");
|
|
883
|
+
const descriptionTextArea = this.getElementById("description");
|
|
884
|
+
const extensionDataTextArea = this.getElementById("extension-data");
|
|
840
885
|
hide(blockContainer);
|
|
841
886
|
hide(systemBlock);
|
|
842
887
|
hide(processBlock);
|
|
@@ -857,34 +902,34 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
857
902
|
if (extensionData && extensionData.length > MAX_EXTENSION_DATA_LENGTH) {
|
|
858
903
|
show(downloadExtensionDataLink);
|
|
859
904
|
const date = ( new Date());
|
|
860
|
-
const formattedDate = date.toISOString().split(
|
|
861
|
-
const formattedTime = date.toTimeString().split(
|
|
905
|
+
const formattedDate = date.toISOString().split("T")[0];
|
|
906
|
+
const formattedTime = date.toTimeString().split(" ")[0].replace(/:/g, "-");
|
|
862
907
|
const fileName = `extensionData_${formattedDate}_${formattedTime}.md`;
|
|
863
908
|
const handleLinkClick = async () => {
|
|
864
909
|
const downloadPath = await this.fileDialogService.showSaveDialog({
|
|
865
|
-
title: ( localize(
|
|
910
|
+
title: ( localize(8742, "Save Extension Data")),
|
|
866
911
|
availableFileSystems: [Schemas.file],
|
|
867
|
-
defaultUri: joinPath(await this.fileDialogService.defaultFilePath(Schemas.file), fileName)
|
|
912
|
+
defaultUri: joinPath(await this.fileDialogService.defaultFilePath(Schemas.file), fileName)
|
|
868
913
|
});
|
|
869
914
|
if (downloadPath) {
|
|
870
915
|
await this.fileService.writeFile(downloadPath, VSBuffer.fromString(extensionData));
|
|
871
916
|
}
|
|
872
917
|
};
|
|
873
|
-
downloadExtensionDataLink.addEventListener(
|
|
918
|
+
downloadExtensionDataLink.addEventListener("click", handleLinkClick);
|
|
874
919
|
this._register({
|
|
875
|
-
dispose: () => downloadExtensionDataLink.removeEventListener(
|
|
920
|
+
dispose: () => downloadExtensionDataLink.removeEventListener("click", handleLinkClick)
|
|
876
921
|
});
|
|
877
922
|
}
|
|
878
923
|
if (selectedExtension && this.nonGitHubIssueUrl) {
|
|
879
924
|
hide(titleTextArea);
|
|
880
925
|
hide(descriptionTextArea);
|
|
881
|
-
reset(descriptionTitle, ( localize(
|
|
926
|
+
reset(descriptionTitle, ( localize(8743, "This extension handles issues outside of VS Code")));
|
|
882
927
|
reset(descriptionSubtitle, ( localize(
|
|
883
|
-
|
|
928
|
+
8744,
|
|
884
929
|
"The '{0}' extension prefers to use an external issue reporter. To be taken to that issue reporting experience, click the button below.",
|
|
885
930
|
selectedExtension.displayName
|
|
886
931
|
)));
|
|
887
|
-
this.publicGithubButton.label = ( localize(
|
|
932
|
+
this.publicGithubButton.label = ( localize(8745, "Open External Issue Reporter"));
|
|
888
933
|
return;
|
|
889
934
|
}
|
|
890
935
|
if (fileOnExtension && selectedExtension?.data) {
|
|
@@ -911,13 +956,12 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
911
956
|
show(extensionsBlock);
|
|
912
957
|
}
|
|
913
958
|
}
|
|
914
|
-
reset(descriptionTitle, ( localize(
|
|
959
|
+
reset(descriptionTitle, ( localize(8746, "Steps to Reproduce")) + " ", $("span.required-input", undefined, "*"));
|
|
915
960
|
reset(descriptionSubtitle, ( localize(
|
|
916
|
-
|
|
961
|
+
8747,
|
|
917
962
|
"Share the steps needed to reliably reproduce the problem. Please include actual and expected results. We support GitHub-flavored Markdown. You will be able to edit your issue and add screenshots when we preview it on GitHub."
|
|
918
963
|
)));
|
|
919
|
-
}
|
|
920
|
-
else if (issueType === IssueType.PerformanceIssue) {
|
|
964
|
+
} else if (issueType === IssueType.PerformanceIssue) {
|
|
921
965
|
if (!fileOnMarketplace) {
|
|
922
966
|
show(blockContainer);
|
|
923
967
|
show(systemBlock);
|
|
@@ -927,20 +971,18 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
927
971
|
}
|
|
928
972
|
if (fileOnExtension) {
|
|
929
973
|
show(extensionSelector);
|
|
930
|
-
}
|
|
931
|
-
else if (!fileOnMarketplace) {
|
|
974
|
+
} else if (!fileOnMarketplace) {
|
|
932
975
|
show(extensionsBlock);
|
|
933
976
|
}
|
|
934
|
-
reset(descriptionTitle, ( localize(
|
|
977
|
+
reset(descriptionTitle, ( localize(8746, "Steps to Reproduce")) + " ", $("span.required-input", undefined, "*"));
|
|
935
978
|
reset(descriptionSubtitle, ( localize(
|
|
936
|
-
|
|
979
|
+
8748,
|
|
937
980
|
"When did this performance issue happen? Does it occur on startup or after a specific series of actions? We support GitHub-flavored Markdown. You will be able to edit your issue and add screenshots when we preview it on GitHub."
|
|
938
981
|
)));
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
reset(descriptionTitle, ( localize(8442, "Description")) + ' ', $('span.required-input', undefined, '*'));
|
|
982
|
+
} else if (issueType === IssueType.FeatureRequest) {
|
|
983
|
+
reset(descriptionTitle, ( localize(8749, "Description")) + " ", $("span.required-input", undefined, "*"));
|
|
942
984
|
reset(descriptionSubtitle, ( localize(
|
|
943
|
-
|
|
985
|
+
8750,
|
|
944
986
|
"Please describe the feature you would like to see. We support GitHub-flavored Markdown. You will be able to edit your issue and add screenshots when we preview it on GitHub."
|
|
945
987
|
)));
|
|
946
988
|
}
|
|
@@ -949,57 +991,54 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
949
991
|
const inputElement = this.getElementById(inputId);
|
|
950
992
|
const inputValidationMessage = this.getElementById(`${inputId}-empty-error`);
|
|
951
993
|
const descriptionShortMessage = this.getElementById(`description-short-error`);
|
|
952
|
-
if (inputId ===
|
|
994
|
+
if (inputId === "description" && this.nonGitHubIssueUrl && this.data.extensionId) {
|
|
953
995
|
return true;
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
descriptionShortMessage?.classList.add('hidden');
|
|
996
|
+
} else if (!inputElement.value) {
|
|
997
|
+
inputElement.classList.add("invalid-input");
|
|
998
|
+
inputValidationMessage?.classList.remove("hidden");
|
|
999
|
+
descriptionShortMessage?.classList.add("hidden");
|
|
959
1000
|
return false;
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
inputValidationMessage?.classList.add('hidden');
|
|
1001
|
+
} else if (inputId === "description" && inputElement.value.length < 10) {
|
|
1002
|
+
inputElement.classList.add("invalid-input");
|
|
1003
|
+
descriptionShortMessage?.classList.remove("hidden");
|
|
1004
|
+
inputValidationMessage?.classList.add("hidden");
|
|
965
1005
|
return false;
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
descriptionShortMessage?.classList.add('hidden');
|
|
1006
|
+
} else {
|
|
1007
|
+
inputElement.classList.remove("invalid-input");
|
|
1008
|
+
inputValidationMessage?.classList.add("hidden");
|
|
1009
|
+
if (inputId === "description") {
|
|
1010
|
+
descriptionShortMessage?.classList.add("hidden");
|
|
972
1011
|
}
|
|
973
1012
|
return true;
|
|
974
1013
|
}
|
|
975
1014
|
}
|
|
976
1015
|
validateInputs() {
|
|
977
1016
|
let isValid = true;
|
|
978
|
-
[
|
|
1017
|
+
["issue-title", "description", "issue-source"].forEach(elementId => {
|
|
979
1018
|
isValid = this.validateInput(elementId) && isValid;
|
|
980
1019
|
});
|
|
981
1020
|
if (this.issueReporterModel.fileOnExtension()) {
|
|
982
|
-
isValid = this.validateInput(
|
|
1021
|
+
isValid = this.validateInput("extension-selector") && isValid;
|
|
983
1022
|
}
|
|
984
1023
|
return isValid;
|
|
985
1024
|
}
|
|
986
1025
|
async submitToGitHub(issueTitle, issueBody, gitHubDetails) {
|
|
987
1026
|
const url = `https://api.github.com/repos/${gitHubDetails.owner}/${gitHubDetails.repositoryName}/issues`;
|
|
988
1027
|
const init = {
|
|
989
|
-
method:
|
|
1028
|
+
method: "POST",
|
|
990
1029
|
body: JSON.stringify({
|
|
991
1030
|
title: issueTitle,
|
|
992
1031
|
body: issueBody
|
|
993
1032
|
}),
|
|
994
1033
|
headers: ( new Headers({
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1034
|
+
"Content-Type": "application/json",
|
|
1035
|
+
"Authorization": `Bearer ${this.data.githubAccessToken}`,
|
|
1036
|
+
"User-Agent": "request"
|
|
998
1037
|
}))
|
|
999
1038
|
};
|
|
1000
1039
|
const response = await fetch(url, init);
|
|
1001
1040
|
if (!response.ok) {
|
|
1002
|
-
console.error(
|
|
1041
|
+
console.error("Invalid GitHub URL provided.");
|
|
1003
1042
|
return false;
|
|
1004
1043
|
}
|
|
1005
1044
|
const result = await response.json();
|
|
@@ -1017,32 +1056,32 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
1017
1056
|
}
|
|
1018
1057
|
}
|
|
1019
1058
|
if (!this.validateInputs()) {
|
|
1020
|
-
const invalidInput = this.window.document.getElementsByClassName(
|
|
1059
|
+
const invalidInput = this.window.document.getElementsByClassName("invalid-input");
|
|
1021
1060
|
if (invalidInput.length) {
|
|
1022
1061
|
invalidInput[0].focus();
|
|
1023
1062
|
}
|
|
1024
|
-
this.addEventListener(
|
|
1025
|
-
this.validateInput(
|
|
1063
|
+
this.addEventListener("issue-title", "input", _ => {
|
|
1064
|
+
this.validateInput("issue-title");
|
|
1026
1065
|
});
|
|
1027
|
-
this.addEventListener(
|
|
1028
|
-
this.validateInput(
|
|
1066
|
+
this.addEventListener("description", "input", _ => {
|
|
1067
|
+
this.validateInput("description");
|
|
1029
1068
|
});
|
|
1030
|
-
this.addEventListener(
|
|
1031
|
-
this.validateInput(
|
|
1069
|
+
this.addEventListener("issue-source", "change", _ => {
|
|
1070
|
+
this.validateInput("issue-source");
|
|
1032
1071
|
});
|
|
1033
1072
|
if (this.issueReporterModel.fileOnExtension()) {
|
|
1034
|
-
this.addEventListener(
|
|
1035
|
-
this.validateInput(
|
|
1073
|
+
this.addEventListener("extension-selector", "change", _ => {
|
|
1074
|
+
this.validateInput("extension-selector");
|
|
1036
1075
|
});
|
|
1037
1076
|
}
|
|
1038
1077
|
return false;
|
|
1039
1078
|
}
|
|
1040
1079
|
this.hasBeenSubmitted = true;
|
|
1041
|
-
const issueTitle = this.getElementById(
|
|
1080
|
+
const issueTitle = this.getElementById("issue-title").value;
|
|
1042
1081
|
const issueBody = this.issueReporterModel.serialize();
|
|
1043
1082
|
let issueUrl = privateUri ? this.getPrivateIssueUrl() : this.getIssueUrl();
|
|
1044
1083
|
if (!issueUrl) {
|
|
1045
|
-
console.error(`No ${privateUri ?
|
|
1084
|
+
console.error(`No ${privateUri ? "private " : ""}issue url found`);
|
|
1046
1085
|
return false;
|
|
1047
1086
|
}
|
|
1048
1087
|
if (selectedExtension?.uri) {
|
|
@@ -1053,16 +1092,15 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
1053
1092
|
if (this.data.githubAccessToken && gitHubDetails && shouldCreate) {
|
|
1054
1093
|
return this.submitToGitHub(issueTitle, issueBody, gitHubDetails);
|
|
1055
1094
|
}
|
|
1056
|
-
const baseUrl = this.getIssueUrlWithTitle(this.getElementById(
|
|
1095
|
+
const baseUrl = this.getIssueUrlWithTitle(this.getElementById("issue-title").value, issueUrl);
|
|
1057
1096
|
let url = baseUrl + `&body=${encodeURIComponent(issueBody)}`;
|
|
1058
1097
|
url = this.addTemplateToUrl(url, gitHubDetails?.owner, gitHubDetails?.repositoryName);
|
|
1059
1098
|
if (url.length > MAX_URL_LENGTH) {
|
|
1060
1099
|
try {
|
|
1061
1100
|
url = await this.writeToClipboard(baseUrl, issueBody);
|
|
1062
1101
|
url = this.addTemplateToUrl(url, gitHubDetails?.owner, gitHubDetails?.repositoryName);
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
console.error('Writing to clipboard failed');
|
|
1102
|
+
} catch (_) {
|
|
1103
|
+
console.error("Writing to clipboard failed");
|
|
1066
1104
|
return false;
|
|
1067
1105
|
}
|
|
1068
1106
|
}
|
|
@@ -1075,32 +1113,27 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
1075
1113
|
throw ( new CancellationError());
|
|
1076
1114
|
}
|
|
1077
1115
|
return baseUrl + `&body=${encodeURIComponent(( localize(
|
|
1078
|
-
|
|
1116
|
+
8751,
|
|
1079
1117
|
"We have written the needed data into your clipboard because it was too large to send. Please paste."
|
|
1080
1118
|
)))}`;
|
|
1081
1119
|
}
|
|
1082
1120
|
addTemplateToUrl(baseUrl, owner, repositoryName) {
|
|
1083
1121
|
const isVscode = this.issueReporterModel.getData().fileOnProduct;
|
|
1084
|
-
const isMicrosoft = owner?.toLowerCase() ===
|
|
1085
|
-
const needsTemplate = isVscode || (isMicrosoft && (repositoryName ===
|
|
1122
|
+
const isMicrosoft = owner?.toLowerCase() === "microsoft";
|
|
1123
|
+
const needsTemplate = isVscode || (isMicrosoft && (repositoryName === "vscode" || repositoryName === "vscode-python"));
|
|
1086
1124
|
if (needsTemplate) {
|
|
1087
1125
|
try {
|
|
1088
1126
|
const url = ( new URL(baseUrl));
|
|
1089
|
-
url.searchParams.set(
|
|
1127
|
+
url.searchParams.set("template", "bug_report.md");
|
|
1090
1128
|
return ( url.toString());
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
return baseUrl + '&template=bug_report.md';
|
|
1129
|
+
} catch {
|
|
1130
|
+
return baseUrl + "&template=bug_report.md";
|
|
1094
1131
|
}
|
|
1095
1132
|
}
|
|
1096
1133
|
return baseUrl;
|
|
1097
1134
|
}
|
|
1098
1135
|
getIssueUrl() {
|
|
1099
|
-
return this.issueReporterModel.fileOnExtension()
|
|
1100
|
-
? this.getExtensionGitHubUrl()
|
|
1101
|
-
: this.issueReporterModel.getData().fileOnMarketplace
|
|
1102
|
-
? this.product.reportMarketplaceIssueUrl
|
|
1103
|
-
: this.product.reportIssueUrl;
|
|
1136
|
+
return this.issueReporterModel.fileOnExtension() ? this.getExtensionGitHubUrl() : this.issueReporterModel.getData().fileOnMarketplace ? this.product.reportMarketplaceIssueUrl : this.product.reportIssueUrl;
|
|
1104
1137
|
}
|
|
1105
1138
|
getPrivateIssueUrl() {
|
|
1106
1139
|
return URI.revive(this.data.privateUri)?.toString();
|
|
@@ -1112,60 +1145,65 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
1112
1145
|
owner: match[1],
|
|
1113
1146
|
repositoryName: match[2]
|
|
1114
1147
|
};
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
console.error('No GitHub issues match');
|
|
1148
|
+
} else {
|
|
1149
|
+
console.error("No GitHub issues match");
|
|
1118
1150
|
}
|
|
1119
1151
|
return undefined;
|
|
1120
1152
|
}
|
|
1121
1153
|
getExtensionGitHubUrl() {
|
|
1122
|
-
let repositoryUrl =
|
|
1154
|
+
let repositoryUrl = "";
|
|
1123
1155
|
const bugsUrl = this.getExtensionBugsUrl();
|
|
1124
1156
|
const extensionUrl = this.getExtensionRepositoryUrl();
|
|
1125
1157
|
if (bugsUrl && bugsUrl.match(/^https?:\/\/github\.com\/([^\/]*)\/([^\/]*)\/?(\/issues)?$/)) {
|
|
1126
1158
|
repositoryUrl = normalizeGitHubUrl(bugsUrl);
|
|
1127
|
-
}
|
|
1128
|
-
else if (extensionUrl && extensionUrl.match(/^https?:\/\/github\.com\/([^\/]*)\/([^\/]*)$/)) {
|
|
1159
|
+
} else if (extensionUrl && extensionUrl.match(/^https?:\/\/github\.com\/([^\/]*)\/([^\/]*)$/)) {
|
|
1129
1160
|
repositoryUrl = normalizeGitHubUrl(extensionUrl);
|
|
1130
|
-
}
|
|
1131
|
-
else {
|
|
1161
|
+
} else {
|
|
1132
1162
|
this.nonGitHubIssueUrl = true;
|
|
1133
|
-
repositoryUrl = bugsUrl || extensionUrl ||
|
|
1163
|
+
repositoryUrl = bugsUrl || extensionUrl || "";
|
|
1134
1164
|
}
|
|
1135
1165
|
return repositoryUrl;
|
|
1136
1166
|
}
|
|
1137
1167
|
getIssueUrlWithTitle(issueTitle, repositoryUrl) {
|
|
1138
1168
|
if (this.issueReporterModel.fileOnExtension()) {
|
|
1139
|
-
repositoryUrl = repositoryUrl +
|
|
1169
|
+
repositoryUrl = repositoryUrl + "/issues/new";
|
|
1140
1170
|
}
|
|
1141
|
-
const queryStringPrefix = repositoryUrl.indexOf(
|
|
1171
|
+
const queryStringPrefix = repositoryUrl.indexOf("?") === -1 ? "?" : "&";
|
|
1142
1172
|
return `${repositoryUrl}${queryStringPrefix}title=${encodeURIComponent(issueTitle)}`;
|
|
1143
1173
|
}
|
|
1144
1174
|
clearExtensionData() {
|
|
1145
1175
|
this.nonGitHubIssueUrl = false;
|
|
1146
|
-
this.issueReporterModel.update({
|
|
1147
|
-
|
|
1176
|
+
this.issueReporterModel.update({
|
|
1177
|
+
extensionData: undefined
|
|
1178
|
+
});
|
|
1179
|
+
this.data.issueBody = this.data.issueBody || "";
|
|
1148
1180
|
this.data.data = undefined;
|
|
1149
1181
|
this.data.uri = undefined;
|
|
1150
1182
|
this.data.privateUri = undefined;
|
|
1151
1183
|
}
|
|
1152
1184
|
async updateExtensionStatus(extension) {
|
|
1153
|
-
this.issueReporterModel.update({
|
|
1185
|
+
this.issueReporterModel.update({
|
|
1186
|
+
selectedExtension: extension
|
|
1187
|
+
});
|
|
1154
1188
|
const template = this.data.issueBody;
|
|
1155
1189
|
if (template) {
|
|
1156
|
-
const descriptionTextArea = this.getElementById(
|
|
1190
|
+
const descriptionTextArea = this.getElementById("description");
|
|
1157
1191
|
const descriptionText = descriptionTextArea.value;
|
|
1158
|
-
if (descriptionText ===
|
|
1159
|
-
const fullTextArea = descriptionText + (descriptionText ===
|
|
1192
|
+
if (descriptionText === "" || !descriptionText.includes(( template.toString()))) {
|
|
1193
|
+
const fullTextArea = descriptionText + (descriptionText === "" ? "" : "\n") + ( template.toString());
|
|
1160
1194
|
descriptionTextArea.value = fullTextArea;
|
|
1161
|
-
this.issueReporterModel.update({
|
|
1195
|
+
this.issueReporterModel.update({
|
|
1196
|
+
issueDescription: fullTextArea
|
|
1197
|
+
});
|
|
1162
1198
|
}
|
|
1163
1199
|
}
|
|
1164
1200
|
const data = this.data.data;
|
|
1165
1201
|
if (data) {
|
|
1166
|
-
this.issueReporterModel.update({
|
|
1202
|
+
this.issueReporterModel.update({
|
|
1203
|
+
extensionData: data
|
|
1204
|
+
});
|
|
1167
1205
|
extension.data = data;
|
|
1168
|
-
const extensionDataBlock = this.window.document.querySelector(
|
|
1206
|
+
const extensionDataBlock = this.window.document.querySelector(".block-extension-data");
|
|
1169
1207
|
show(extensionDataBlock);
|
|
1170
1208
|
this.renderBlocks();
|
|
1171
1209
|
}
|
|
@@ -1175,14 +1213,14 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
1175
1213
|
this.updateIssueReporterUri(extension);
|
|
1176
1214
|
}
|
|
1177
1215
|
this.validateSelectedExtension();
|
|
1178
|
-
const title = this.getElementById(
|
|
1216
|
+
const title = this.getElementById("issue-title").value;
|
|
1179
1217
|
this.searchExtensionIssues(title);
|
|
1180
1218
|
this.updateButtonStates();
|
|
1181
1219
|
this.renderBlocks();
|
|
1182
1220
|
}
|
|
1183
1221
|
validateSelectedExtension() {
|
|
1184
|
-
const extensionValidationMessage = this.getElementById(
|
|
1185
|
-
const extensionValidationNoUrlsMessage = this.getElementById(
|
|
1222
|
+
const extensionValidationMessage = this.getElementById("extension-selection-validation-error");
|
|
1223
|
+
const extensionValidationNoUrlsMessage = this.getElementById("extension-selection-validation-error-no-url");
|
|
1186
1224
|
hide(extensionValidationMessage);
|
|
1187
1225
|
hide(extensionValidationNoUrlsMessage);
|
|
1188
1226
|
const extension = this.issueReporterModel.getData().selectedExtension;
|
|
@@ -1196,8 +1234,7 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
1196
1234
|
const hasValidGitHubUrl = this.getExtensionGitHubUrl();
|
|
1197
1235
|
if (hasValidGitHubUrl) {
|
|
1198
1236
|
this.publicGithubButton.enabled = true;
|
|
1199
|
-
}
|
|
1200
|
-
else {
|
|
1237
|
+
} else {
|
|
1201
1238
|
this.setExtensionValidationMessage();
|
|
1202
1239
|
this.publicGithubButton.enabled = false;
|
|
1203
1240
|
}
|
|
@@ -1206,11 +1243,11 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
1206
1243
|
this.openReporter = true;
|
|
1207
1244
|
this.loadingExtensionData = true;
|
|
1208
1245
|
this.updateButtonStates();
|
|
1209
|
-
const extensionDataCaption = this.getElementById(
|
|
1246
|
+
const extensionDataCaption = this.getElementById("extension-id");
|
|
1210
1247
|
hide(extensionDataCaption);
|
|
1211
|
-
const extensionDataCaption2 = Array.from(this.window.document.querySelectorAll(
|
|
1248
|
+
const extensionDataCaption2 = Array.from(this.window.document.querySelectorAll(".ext-parens"));
|
|
1212
1249
|
extensionDataCaption2.forEach(extensionDataCaption2 => hide(extensionDataCaption2));
|
|
1213
|
-
const showLoading = this.getElementById(
|
|
1250
|
+
const showLoading = this.getElementById("ext-loading");
|
|
1214
1251
|
show(showLoading);
|
|
1215
1252
|
while (showLoading.firstChild) {
|
|
1216
1253
|
showLoading.firstChild.remove();
|
|
@@ -1222,11 +1259,11 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
1222
1259
|
this.openReporter = fromReporter;
|
|
1223
1260
|
this.loadingExtensionData = false;
|
|
1224
1261
|
this.updateButtonStates();
|
|
1225
|
-
const extensionDataCaption = this.getElementById(
|
|
1262
|
+
const extensionDataCaption = this.getElementById("extension-id");
|
|
1226
1263
|
show(extensionDataCaption);
|
|
1227
|
-
const extensionDataCaption2 = Array.from(this.window.document.querySelectorAll(
|
|
1264
|
+
const extensionDataCaption2 = Array.from(this.window.document.querySelectorAll(".ext-parens"));
|
|
1228
1265
|
extensionDataCaption2.forEach(extensionDataCaption2 => show(extensionDataCaption2));
|
|
1229
|
-
const hideLoading = this.getElementById(
|
|
1266
|
+
const hideLoading = this.getElementById("ext-loading");
|
|
1230
1267
|
hide(hideLoading);
|
|
1231
1268
|
if (hideLoading.firstChild) {
|
|
1232
1269
|
element.remove();
|
|
@@ -1234,64 +1271,81 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
1234
1271
|
this.renderBlocks();
|
|
1235
1272
|
}
|
|
1236
1273
|
setExtensionValidationMessage() {
|
|
1237
|
-
const extensionValidationMessage = this.getElementById(
|
|
1238
|
-
const extensionValidationNoUrlsMessage = this.getElementById(
|
|
1274
|
+
const extensionValidationMessage = this.getElementById("extension-selection-validation-error");
|
|
1275
|
+
const extensionValidationNoUrlsMessage = this.getElementById("extension-selection-validation-error-no-url");
|
|
1239
1276
|
const bugsUrl = this.getExtensionBugsUrl();
|
|
1240
1277
|
if (bugsUrl) {
|
|
1241
1278
|
show(extensionValidationMessage);
|
|
1242
|
-
const link = this.getElementById(
|
|
1279
|
+
const link = this.getElementById("extensionBugsLink");
|
|
1243
1280
|
link.textContent = bugsUrl;
|
|
1244
1281
|
return;
|
|
1245
1282
|
}
|
|
1246
1283
|
const extensionUrl = this.getExtensionRepositoryUrl();
|
|
1247
1284
|
if (extensionUrl) {
|
|
1248
1285
|
show(extensionValidationMessage);
|
|
1249
|
-
const link = this.getElementById(
|
|
1286
|
+
const link = this.getElementById("extensionBugsLink");
|
|
1250
1287
|
link.textContent = extensionUrl;
|
|
1251
1288
|
return;
|
|
1252
1289
|
}
|
|
1253
1290
|
show(extensionValidationNoUrlsMessage);
|
|
1254
1291
|
}
|
|
1255
1292
|
updateProcessInfo(state) {
|
|
1256
|
-
const target = this.window.document.querySelector(
|
|
1293
|
+
const target = this.window.document.querySelector(".block-process .block-info");
|
|
1257
1294
|
if (target) {
|
|
1258
|
-
reset(target, $(
|
|
1295
|
+
reset(target, $("code", undefined, state.processInfo ?? ""));
|
|
1259
1296
|
}
|
|
1260
1297
|
}
|
|
1261
1298
|
updateWorkspaceInfo(state) {
|
|
1262
|
-
this.window.document.querySelector(
|
|
1299
|
+
this.window.document.querySelector(".block-workspace .block-info code").textContent = "\n" + state.workspaceInfo;
|
|
1263
1300
|
}
|
|
1264
1301
|
updateExtensionTable(extensions, numThemeExtensions) {
|
|
1265
|
-
const target = this.window.document.querySelector(
|
|
1302
|
+
const target = this.window.document.querySelector(".block-extensions .block-info");
|
|
1266
1303
|
if (target) {
|
|
1267
1304
|
if (this.disableExtensions) {
|
|
1268
|
-
reset(target, ( localize(
|
|
1305
|
+
reset(target, ( localize(8752, "Extensions are disabled")));
|
|
1269
1306
|
return;
|
|
1270
1307
|
}
|
|
1271
|
-
const themeExclusionStr = numThemeExtensions ? `\n(${numThemeExtensions} theme extensions excluded)` :
|
|
1308
|
+
const themeExclusionStr = numThemeExtensions ? `\n(${numThemeExtensions} theme extensions excluded)` : "";
|
|
1272
1309
|
extensions = extensions || [];
|
|
1273
1310
|
if (!extensions.length) {
|
|
1274
|
-
target.innerText =
|
|
1311
|
+
target.innerText = "Extensions: none" + themeExclusionStr;
|
|
1275
1312
|
return;
|
|
1276
1313
|
}
|
|
1277
|
-
reset(
|
|
1314
|
+
reset(
|
|
1315
|
+
target,
|
|
1316
|
+
this.getExtensionTableHtml(extensions),
|
|
1317
|
+
createTextNode(themeExclusionStr)
|
|
1318
|
+
);
|
|
1278
1319
|
}
|
|
1279
1320
|
}
|
|
1280
1321
|
getExtensionTableHtml(extensions) {
|
|
1281
|
-
return $(
|
|
1282
|
-
|
|
1283
|
-
|
|
1322
|
+
return $("table", undefined, $(
|
|
1323
|
+
"tr",
|
|
1324
|
+
undefined,
|
|
1325
|
+
$("th", undefined, "Extension"),
|
|
1326
|
+
$("th", undefined, "Author (truncated)"),
|
|
1327
|
+
$("th", undefined, "Version")
|
|
1328
|
+
), ...( extensions.map(extension => $(
|
|
1329
|
+
"tr",
|
|
1330
|
+
undefined,
|
|
1331
|
+
$("td", undefined, extension.name),
|
|
1332
|
+
$("td", undefined, extension.publisher?.substr(0, 3) ?? "N/A"),
|
|
1333
|
+
$("td", undefined, extension.version)
|
|
1334
|
+
))));
|
|
1284
1335
|
}
|
|
1285
1336
|
async openLink(eventOrUrl) {
|
|
1286
|
-
if (typeof eventOrUrl ===
|
|
1287
|
-
await this.openerService.open(eventOrUrl, {
|
|
1288
|
-
|
|
1289
|
-
|
|
1337
|
+
if (typeof eventOrUrl === "string") {
|
|
1338
|
+
await this.openerService.open(eventOrUrl, {
|
|
1339
|
+
openExternal: true
|
|
1340
|
+
});
|
|
1341
|
+
} else {
|
|
1290
1342
|
const event = eventOrUrl;
|
|
1291
1343
|
event.preventDefault();
|
|
1292
1344
|
event.stopPropagation();
|
|
1293
1345
|
if (event.which < 3) {
|
|
1294
|
-
await this.openerService.open(event.target.href, {
|
|
1346
|
+
await this.openerService.open(event.target.href, {
|
|
1347
|
+
openExternal: true
|
|
1348
|
+
});
|
|
1295
1349
|
}
|
|
1296
1350
|
}
|
|
1297
1351
|
}
|
|
@@ -1299,8 +1353,7 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
1299
1353
|
const element = this.window.document.getElementById(elementId);
|
|
1300
1354
|
if (element) {
|
|
1301
1355
|
return element;
|
|
1302
|
-
}
|
|
1303
|
-
else {
|
|
1356
|
+
} else {
|
|
1304
1357
|
return undefined;
|
|
1305
1358
|
}
|
|
1306
1359
|
}
|
|
@@ -1309,26 +1362,19 @@ let BaseIssueReporterService = class BaseIssueReporterService extends Disposable
|
|
|
1309
1362
|
element?.addEventListener(eventType, handler);
|
|
1310
1363
|
}
|
|
1311
1364
|
};
|
|
1312
|
-
BaseIssueReporterService.__decorator = ( __decorate([
|
|
1313
|
-
|
|
1314
|
-
],
|
|
1315
|
-
BaseIssueReporterService.
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
( __param(7, IThemeService)),
|
|
1321
|
-
( __param(8, IFileService)),
|
|
1322
|
-
( __param(9, IFileDialogService)),
|
|
1323
|
-
( __param(10, IContextMenuService)),
|
|
1324
|
-
( __param(11, IAuthenticationService)),
|
|
1325
|
-
( __param(12, IOpenerService))
|
|
1326
|
-
], BaseIssueReporterService));
|
|
1365
|
+
BaseIssueReporterService.__decorator = ( __decorate([debounce(300)], BaseIssueReporterService.prototype, "searchGitHub", null));
|
|
1366
|
+
BaseIssueReporterService.__decorator = ( __decorate(
|
|
1367
|
+
[debounce(300)],
|
|
1368
|
+
BaseIssueReporterService.prototype,
|
|
1369
|
+
"searchDuplicates",
|
|
1370
|
+
null
|
|
1371
|
+
));
|
|
1372
|
+
BaseIssueReporterService = ( __decorate([( __param(6, IIssueFormService)), ( __param(7, IThemeService)), ( __param(8, IFileService)), ( __param(9, IFileDialogService)), ( __param(10, IContextMenuService)), ( __param(11, IAuthenticationService)), ( __param(12, IOpenerService))], BaseIssueReporterService));
|
|
1327
1373
|
function hide(el) {
|
|
1328
|
-
el?.classList.add(
|
|
1374
|
+
el?.classList.add("hidden");
|
|
1329
1375
|
}
|
|
1330
1376
|
function show(el) {
|
|
1331
|
-
el?.classList.remove(
|
|
1377
|
+
el?.classList.remove("hidden");
|
|
1332
1378
|
}
|
|
1333
1379
|
|
|
1334
1380
|
export { BaseIssueReporterService, hide, show };
|