Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show contributed issues in quick access #206303

Merged
merged 12 commits into from
Mar 7, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
description: localize('extensionsDeferredStartupFinishedActivation', "When enabled, extensions which declare the `onStartupFinished` activation event will be activated after a timeout."),
default: false
},
'extensions.experimental.quickAcessExtensions': {
'extensions.experimental.issueQuickAccess': {
type: 'boolean',
description: localize('extensionsInQuickAccess', "When enabled, extensions can be searched for via Quick Access and report issues from there."),
default: true
Expand Down
114 changes: 54 additions & 60 deletions src/vs/workbench/contrib/issue/browser/issueQuickAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,77 +34,71 @@ export class IssueQuickAccess extends PickerQuickAccessProvider<IPickerQuickAcce
}

protected override _getPicks(filter: string): Picks<IPickerQuickAccessItem> | FastAndSlowPicks<IPickerQuickAccessItem> | Promise<Picks<IPickerQuickAccessItem> | FastAndSlowPicks<IPickerQuickAccessItem>> | null {
if (this.configurationService.getValue<string>('extensions.experimental.quickAcessExtensions')) {
const issuePicks: Array<IPickerQuickAccessItem | IQuickPickSeparator> = [];
const extensionIdList: Array<string> = [];

// add regular open issue reporter button
const createTerminalLabel1 = this.productService.quality === 'stable' ? localize("workbench.action.openIssueReporter", "Visual Studio Code") : localize("workbench.action.openIssueReporterInsiders", "Visual Studio Code: Insiders");
issuePicks.push({
label: `$(plus) ${createTerminalLabel1}`,
ariaLabel: createTerminalLabel1,
accept: () => this.commandService.executeCommand('workbench.action.openIssueReporter', { issueSource: IssueSource.VSCode })
});

if (issuePicks.length > 0) {
issuePicks.push({ type: 'separator' });
if (!this.configurationService.getValue<boolean>('extensions.experimental.issueQuickAccess')) {
justschen marked this conversation as resolved.
Show resolved Hide resolved
return null;
}
const issuePicks: Array<IPickerQuickAccessItem | IQuickPickSeparator> = [];
justschen marked this conversation as resolved.
Show resolved Hide resolved
const extensionIdSet: Set<string> = new Set();
justschen marked this conversation as resolved.
Show resolved Hide resolved

// add regular open issue reporter button
const productLabel = this.productService.nameLong === 'stable' ? localize("workbench.action.openIssueReporter", "Visual Studio Code") : localize("workbench.action.openIssueReporterInsiders", "Visual Studio Code: Insiders");
justschen marked this conversation as resolved.
Show resolved Hide resolved
issuePicks.push({
label: productLabel,
ariaLabel: productLabel,
accept: () => this.commandService.executeCommand('workbench.action.openIssueReporter', { issueSource: IssueSource.VSCode })
});

issuePicks.push({ type: 'separator' });

const marketPlaceLabel = localize("workbench.action.openIssueReporter2", "Extension Marketplace");
issuePicks.push({
label: marketPlaceLabel,
ariaLabel: marketPlaceLabel,
accept: () => this.commandService.executeCommand('workbench.action.openIssueReporter', { issueSource: IssueSource.Marketplace })
});

issuePicks.push({ type: 'separator', label: localize('extensions', "Extensions: Custom Reporting") });

// creates menu from contributed
const menu = this.menuService.createMenu(MenuId.IssueReporter, this.contextKeyService);

// render menu and dispose
justschen marked this conversation as resolved.
Show resolved Hide resolved
const actions = menu.getActions({ renderShortTitle: true }).flatMap(entry => entry[1]);

// create picks from contributed menu
actions.forEach(action => {
if ('source' in action.item && action.item.source) {
extensionIdSet.add(action.item.source.id);
}

const createTerminalLabel2 = localize("workbench.action.openIssueReporter2", "Extension Marketplace");
issuePicks.push({
label: `$(plus) ${createTerminalLabel2}`,
ariaLabel: createTerminalLabel2,
accept: () => this.commandService.executeCommand('workbench.action.openIssueReporter', { issueSource: IssueSource.Marketplace })
});



if (issuePicks.length > 0) {
issuePicks.push({ type: 'separator', label: localize('extensions', "Extensions: Custom Reporting") });
const pick = this._createPick(filter, action);
if (pick) {
issuePicks.push(pick);
}
// creates menu from contributed
const menu = this.menuService.createMenu(MenuId.IssueReporter, this.contextKeyService);
});

// render menu and dispose
const actions = menu.getActions({ renderShortTitle: true }).flatMap(entry => entry[1]);

issuePicks.push({ type: 'separator', label: localize('otherExtensions', "Other Extensions") });

// create picks from contributed menu
actions.forEach(action => {
if ('source' in action.item && action.item.source) {
extensionIdList.push(action.item?.source?.id);
}

const pick = this._createPick(filter, action);
// create picks from extensions
this.extensionService.extensions.forEach(extension => {
if (!extension.isBuiltin) {
const pick = this._createPick(filter, undefined, extension);
const id = extension.identifier.value;
if (pick) {
issuePicks.push(pick);
}
});

if (issuePicks.length > 0) {
issuePicks.push({ type: 'separator', label: localize('otherExtensions', "Other Extensions") });
}

// create picks from extensions
this.extensionService.extensions.forEach(extension => {
if (!extension.isBuiltin) {
const pick = this._createPick(filter, undefined, extension);
const id = extension.identifier.value;
if (pick) {
if (extensionIdList.includes(id)) {
return;
}
else {
issuePicks.push(pick);
}
if (extensionIdSet.has(id)) {
return;
}
else {
issuePicks.push(pick);
}
extensionIdList.push(id);
}
});
extensionIdSet.add(id);
}
});

return issuePicks;
}
return null;
return issuePicks;
}

private _createPick(filter: string, action?: MenuItemAction | SubmenuItemAction | undefined, extension?: IRelaxedExtensionDescription): IPickerQuickAccessItem | undefined {
Expand Down
Loading