mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 22:12:26 +01:00
Expose vscode.openIssueReporter command that allows passing an extensionId to open the reporter with
This commit is contained in:
committed by
GitHub
parent
b53be6efef
commit
ea7e2600d8
@@ -88,6 +88,8 @@ export class IssueReporter extends Disposable {
|
||||
os: `${os.type()} ${os.arch()} ${os.release()}${isSnap ? ' snap' : ''}`
|
||||
},
|
||||
extensionsDisabled: !!this.environmentService.disableExtensions,
|
||||
fileOnExtension: configuration.data.extensionId ? true : undefined,
|
||||
selectedExtension: configuration.data.extensionId ? configuration.data.enabledExtensions.filter(extension => extension.id === configuration.data.extensionId)[0] : undefined
|
||||
});
|
||||
|
||||
const issueReporterElement = this.getElementById('issue-reporter');
|
||||
@@ -698,9 +700,13 @@ export class IssueReporter extends Disposable {
|
||||
|
||||
private setSourceOptions(): void {
|
||||
const sourceSelect = this.getElementById('issue-source')! as HTMLSelectElement;
|
||||
const selected = sourceSelect.selectedIndex;
|
||||
const { issueType, fileOnExtension } = this.issueReporterModel.getData();
|
||||
let selected = sourceSelect.selectedIndex;
|
||||
if (selected === -1 && fileOnExtension !== undefined) {
|
||||
selected = fileOnExtension ? 2 : 1;
|
||||
}
|
||||
|
||||
sourceSelect.innerHTML = '';
|
||||
const { issueType } = this.issueReporterModel.getData();
|
||||
if (issueType === IssueType.FeatureRequest) {
|
||||
sourceSelect.append(...[
|
||||
this.makeOption('', localize('selectSource', "Select source"), true),
|
||||
@@ -959,10 +965,15 @@ export class IssueReporter extends Disposable {
|
||||
return 0;
|
||||
});
|
||||
|
||||
const makeOption = (extension: IOption) => `<option value="${extension.id}">${escape(extension.name)}</option>`;
|
||||
const makeOption = (extension: IOption, selectedExtension?: IssueReporterExtensionData) => {
|
||||
const selected = selectedExtension && extension.id === selectedExtension.id;
|
||||
return `<option value="${extension.id}" ${selected ? 'selected' : ''}>${escape(extension.name)}</option>`;
|
||||
};
|
||||
|
||||
const extensionsSelector = this.getElementById('extension-selector');
|
||||
if (extensionsSelector) {
|
||||
extensionsSelector.innerHTML = '<option></option>' + extensionOptions.map(makeOption).join('\n');
|
||||
const { selectedExtension } = this.issueReporterModel.getData();
|
||||
extensionsSelector.innerHTML = '<option></option>' + extensionOptions.map(extension => makeOption(extension, selectedExtension)).join('\n');
|
||||
|
||||
this.addEventListener('extension-selector', 'change', (e: Event) => {
|
||||
const selectedExtensionId = (<HTMLInputElement>e.target).value;
|
||||
|
||||
Reference in New Issue
Block a user