Skip to content

Commit fb1d219

Browse files
committed
microsoft#41071 Update the view quickpick list and add open view in views menu
1 parent 45967cd commit fb1d219

2 files changed

Lines changed: 13 additions & 24 deletions

File tree

src/vs/code/electron-main/menus.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,7 @@ export class CodeMenu {
683683
}
684684

685685
const commands = this.createMenuItem(nls.localize({ key: 'miCommandPalette', comment: ['&& denotes a mnemonic'] }, "&&Command Palette..."), 'workbench.action.showCommands');
686+
const openView = this.createMenuItem(nls.localize({ key: 'miOpenView', comment: ['&& denotes a mnemonic'] }, "&&Open View..."), 'workbench.action.openView');
686687

687688
const fullscreen = new MenuItem(this.withKeybinding('workbench.action.toggleFullScreen', { label: this.mnemonicLabel(nls.localize({ key: 'miToggleFullScreen', comment: ['&& denotes a mnemonic'] }, "Toggle &&Full Screen")), click: () => this.windowsMainService.getLastActiveWindow().toggleFullScreen(), enabled: this.windowsMainService.getWindowCount() > 0 }));
688689
const toggleZenMode = this.createMenuItem(nls.localize('miToggleZenMode', "Toggle Zen Mode"), 'workbench.action.toggleZenMode');
@@ -729,6 +730,7 @@ export class CodeMenu {
729730

730731
arrays.coalesce([
731732
commands,
733+
openView,
732734
__separator__(),
733735
explorer,
734736
search,

src/vs/workbench/parts/quickopen/browser/viewPickerHandler.ts

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -138,40 +138,27 @@ export class ViewPickerHandler extends QuickOpenHandler {
138138

139139
// Viewlets
140140
const viewlets = this.viewletService.getViewlets();
141+
viewlets.forEach((viewlet, index) => viewEntries.push(new ViewEntry(viewlet.name, nls.localize('views', "Views"), () => this.viewletService.openViewlet(viewlet.id, true).done(null, errors.onUnexpectedError))));
142+
143+
// Panels
144+
const panels = this.panelService.getPanels();
145+
panels.forEach((panel, index) => viewEntries.push(new ViewEntry(panel.name, nls.localize('panels', "Panels"), () => this.panelService.openPanel(panel.id, true).done(null, errors.onUnexpectedError))));
146+
147+
// Views
141148
viewlets.forEach((viewlet, index) => {
142149
const viewLocation: ViewLocation = viewlet.id === EXPLORER_VIEWLET_ID ? ViewLocation.Explorer
143150
: viewlet.id === DEBUG_VIEWLET_ID ? ViewLocation.Debug
144151
: viewlet.id === EXTENSIONS_VIEWLET_ID ? ViewLocation.Extensions
145152
: null;
146153

147-
const viewEntriesForViewlet: ViewEntry[] = viewLocation ? getViewEntriesForViewlet(viewlet, viewLocation)
148-
: [new ViewEntry(viewlet.name, nls.localize('views', "Views"), () => this.viewletService.openViewlet(viewlet.id, true).done(null, errors.onUnexpectedError))];
149-
150-
viewEntries.push(...viewEntriesForViewlet);
151-
});
152-
153-
const terminals = this.terminalService.terminalInstances;
154-
155-
// Panels
156-
const panels = this.panelService.getPanels().filter(p => {
157-
if (p.id === OUTPUT_PANEL_ID) {
158-
return false; // since we already show output channels below
154+
if (viewLocation) {
155+
const viewEntriesForViewlet: ViewEntry[] = getViewEntriesForViewlet(viewlet, viewLocation);
156+
viewEntries.push(...viewEntriesForViewlet);
159157
}
160-
161-
if (p.id === TERMINAL_PANEL_ID && terminals.length > 0) {
162-
return false; // since we already show terminal instances below
163-
}
164-
165-
return true;
166-
});
167-
panels.forEach((panel, index) => {
168-
const panelsCategory = nls.localize('panels', "Panels");
169-
const entry = new ViewEntry(panel.name, panelsCategory, () => this.panelService.openPanel(panel.id, true).done(null, errors.onUnexpectedError));
170-
171-
viewEntries.push(entry);
172158
});
173159

174160
// Terminals
161+
const terminals = this.terminalService.terminalInstances;
175162
terminals.forEach((terminal, index) => {
176163
const terminalsCategory = nls.localize('terminals', "Terminal");
177164
const entry = new ViewEntry(nls.localize('terminalTitle', "{0}: {1}", index + 1, terminal.title), terminalsCategory, () => {

0 commit comments

Comments
 (0)