mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 22:12:26 +01:00
Let extensions prepopulate the issue reporter title and description (#91039)
* Let extensions prepopulate the issue reporter title and description Fixes #91028 Adds two new optional arguments to the `vscode.openIssueReporter` command: `issueTitle` and `issueBody`. These are taken using an options object and are used to pre-populate the native issue reporter fields Hooks up these fields for TypeScript's report issue prompt. We use this to post the most recent TS Server error stack * Extract duplicate command id to constant * Log version directly instead of prompting users for it
This commit is contained in:
@@ -97,6 +97,23 @@ export class IssueReporter extends Disposable {
|
||||
this.previewButton = new Button(issueReporterElement);
|
||||
}
|
||||
|
||||
const issueTitle = configuration.data.issueTitle;
|
||||
if (issueTitle) {
|
||||
const issueTitleElement = this.getElementById<HTMLInputElement>('issue-title');
|
||||
if (issueTitleElement) {
|
||||
issueTitleElement.value = issueTitle;
|
||||
}
|
||||
}
|
||||
|
||||
const issueBody = configuration.data.issueBody;
|
||||
if (issueBody) {
|
||||
const description = this.getElementById<HTMLTextAreaElement>('description');
|
||||
if (description) {
|
||||
description.value = issueBody;
|
||||
this.issueReporterModel.update({ issueDescription: issueBody });
|
||||
}
|
||||
}
|
||||
|
||||
ipcRenderer.on('vscode:issuePerformanceInfoResponse', (_: unknown, info: Partial<IssueReporterData>) => {
|
||||
this.logService.trace('issueReporter: Received performance data');
|
||||
this.issueReporterModel.update(info);
|
||||
@@ -1175,8 +1192,8 @@ export class IssueReporter extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private getElementById(elementId: string): HTMLElement | undefined {
|
||||
const element = document.getElementById(elementId);
|
||||
private getElementById<T extends HTMLElement = HTMLElement>(elementId: string): T | undefined {
|
||||
const element = document.getElementById(elementId) as T | undefined;
|
||||
if (element) {
|
||||
return element;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user