-
Notifications
You must be signed in to change notification settings - Fork 28.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show contributed issues in quick access (#206303)
* show contributed issues in quick accesss * moved some files around * cleanup unused import * quick access overhaul: add all extensions, filter no duplicates, contributed at bottom, add button to open extension page, add experimental setting * fix to turn on by default * switch to info button icon instad * added issue file on product and marketplace * differentiate btween insiders and stable * some fixes for now * address comments * review fixes
- Loading branch information
Showing
8 changed files
with
211 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
src/vs/workbench/contrib/issue/browser/issueQuickAccess.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { PickerQuickAccessProvider, IPickerQuickAccessItem, FastAndSlowPicks, Picks, TriggerAction } from 'vs/platform/quickinput/browser/pickerQuickAccess'; | ||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; | ||
import { IMenuService, MenuId, MenuItemAction, SubmenuItemAction } from 'vs/platform/actions/common/actions'; | ||
import { matchesFuzzy } from 'vs/base/common/filters'; | ||
import { IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput'; | ||
import { localize } from 'vs/nls'; | ||
import { ICommandService } from 'vs/platform/commands/common/commands'; | ||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; | ||
import { IRelaxedExtensionDescription } from 'vs/platform/extensions/common/extensions'; | ||
import { ThemeIcon } from 'vs/base/common/themables'; | ||
import { Codicon } from 'vs/base/common/codicons'; | ||
import { IssueSource } from 'vs/platform/issue/common/issue'; | ||
import { IProductService } from 'vs/platform/product/common/productService'; | ||
|
||
export class IssueQuickAccess extends PickerQuickAccessProvider<IPickerQuickAccessItem> { | ||
|
||
static PREFIX = 'issue '; | ||
|
||
constructor( | ||
@IMenuService private readonly menuService: IMenuService, | ||
@IContextKeyService private readonly contextKeyService: IContextKeyService, | ||
@ICommandService private readonly commandService: ICommandService, | ||
@IExtensionService private readonly extensionService: IExtensionService, | ||
@IProductService private readonly productService: IProductService | ||
) { | ||
super(IssueQuickAccess.PREFIX, { canAcceptInBackground: true }); | ||
} | ||
|
||
protected override _getPicks(filter: string): Picks<IPickerQuickAccessItem> | FastAndSlowPicks<IPickerQuickAccessItem> | Promise<Picks<IPickerQuickAccessItem> | FastAndSlowPicks<IPickerQuickAccessItem>> | null { | ||
const issuePicks = new Array<IPickerQuickAccessItem | IQuickPickSeparator>(); | ||
const extensionIdSet = new Set<string>(); | ||
|
||
// add regular open issue reporter button | ||
const productLabel = this.productService.nameLong; | ||
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 | ||
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 pick = this._createPick(filter, action); | ||
if (pick) { | ||
issuePicks.push(pick); | ||
} | ||
}); | ||
|
||
menu.dispose(); | ||
|
||
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 (extensionIdSet.has(id)) { | ||
return; | ||
} | ||
else { | ||
issuePicks.push(pick); | ||
} | ||
} | ||
extensionIdSet.add(id); | ||
} | ||
}); | ||
|
||
return issuePicks; | ||
} | ||
|
||
private _createPick(filter: string, action?: MenuItemAction | SubmenuItemAction | undefined, extension?: IRelaxedExtensionDescription): IPickerQuickAccessItem | undefined { | ||
if (action && 'source' in action.item && action.item.source) { | ||
const label = action.item.source?.title; | ||
const highlights = matchesFuzzy(filter, label, true); | ||
if (highlights) { | ||
return { | ||
label, | ||
highlights: { label: highlights }, | ||
buttons: [{ | ||
iconClass: ThemeIcon.asClassName(Codicon.info), | ||
tooltip: localize('contributedIssuePage', "Open Extension Page") | ||
}], | ||
trigger: () => { | ||
if ('source' in action.item && action.item.source) { | ||
this.commandService.executeCommand('extension.open', action.item.source.id); | ||
} | ||
return TriggerAction.CLOSE_PICKER; | ||
}, | ||
accept: (keyMod, event) => { | ||
action.run(); | ||
} | ||
}; | ||
} | ||
} else if (extension) { | ||
const label = extension.displayName ?? extension.name; | ||
const highlights = matchesFuzzy(filter, label, true); | ||
if (highlights) { | ||
return { | ||
label: label, | ||
highlights: { label: highlights }, | ||
buttons: [{ | ||
iconClass: ThemeIcon.asClassName(Codicon.info), | ||
tooltip: localize('contributedIssuePage', "Open Extension Page") | ||
}], | ||
trigger: () => { | ||
this.commandService.executeCommand('extension.open', extension.identifier.value); | ||
return TriggerAction.CLOSE_PICKER; | ||
}, | ||
accept: (keyMod, event) => { | ||
this.commandService.executeCommand('workbench.action.openIssueReporter', extension.identifier.value); | ||
} | ||
|
||
}; | ||
} | ||
} | ||
return undefined; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters