mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Merge pull request #59070 from Microsoft/octref/58555
Give hierarchy to the Open View quick pick. Fix #58555
This commit is contained in:
commit
c9f7d10187
|
@ -102,6 +102,13 @@ export class ViewPickerHandler extends QuickOpenHandler {
|
|||
return true;
|
||||
});
|
||||
|
||||
const entryToCategory = {};
|
||||
entries.forEach(e => {
|
||||
if (!entryToCategory[e.getLabel()]) {
|
||||
entryToCategory[e.getLabel()] = e.getCategory();
|
||||
}
|
||||
});
|
||||
|
||||
let lastCategory: string;
|
||||
entries.forEach((e, index) => {
|
||||
if (lastCategory !== e.getCategory()) {
|
||||
|
@ -109,6 +116,11 @@ export class ViewPickerHandler extends QuickOpenHandler {
|
|||
|
||||
e.setShowBorder(index > 0);
|
||||
e.setGroupLabel(lastCategory);
|
||||
|
||||
// When the entry category has a parent category, set group label as Parent / Child. For example, Views / Explorer.
|
||||
if (entryToCategory[lastCategory]) {
|
||||
e.setGroupLabel(`${entryToCategory[lastCategory]} / ${lastCategory}`);
|
||||
}
|
||||
} else {
|
||||
e.setShowBorder(false);
|
||||
e.setGroupLabel(void 0);
|
||||
|
@ -136,11 +148,11 @@ export class ViewPickerHandler extends QuickOpenHandler {
|
|||
|
||||
// Viewlets
|
||||
const viewlets = this.viewletService.getViewlets();
|
||||
viewlets.forEach((viewlet, index) => viewEntries.push(new ViewEntry(viewlet.name, nls.localize('views', "Views"), () => this.viewletService.openViewlet(viewlet.id, true))));
|
||||
viewlets.forEach((viewlet, index) => viewEntries.push(new ViewEntry(viewlet.name, nls.localize('views', "Side Bar"), () => this.viewletService.openViewlet(viewlet.id, true))));
|
||||
|
||||
// Panels
|
||||
const panels = this.panelService.getPanels();
|
||||
panels.forEach((panel, index) => viewEntries.push(new ViewEntry(panel.name, nls.localize('panels', "Panels"), () => this.panelService.openPanel(panel.id, true))));
|
||||
panels.forEach((panel, index) => viewEntries.push(new ViewEntry(panel.name, nls.localize('panels', "Panel"), () => this.panelService.openPanel(panel.id, true))));
|
||||
|
||||
// Viewlet Views
|
||||
viewlets.forEach((viewlet, index) => {
|
||||
|
|
Loading…
Reference in a new issue