parent
967aab8156
commit
34f2579863
|
@ -63,7 +63,7 @@ abstract class BaseNavigationAction extends Action {
|
|||
return true;
|
||||
}
|
||||
|
||||
protected navigateToPanel(): IPanel | boolean {
|
||||
protected async navigateToPanel(): Promise<IPanel | boolean> {
|
||||
if (!this.layoutService.isVisible(Parts.PANEL_PART)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ abstract class BaseNavigationAction extends Action {
|
|||
|
||||
const activePanelId = activePanel.getId();
|
||||
|
||||
const res = this.panelService.openPanel(activePanelId, true);
|
||||
const res = await this.panelService.openPanel(activePanelId, true);
|
||||
if (!res) {
|
||||
return false;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ class NavigateRightAction extends BaseNavigationAction {
|
|||
}
|
||||
|
||||
if (!isPanelPositionDown) {
|
||||
return Promise.resolve(this.navigateToPanel());
|
||||
return this.navigateToPanel();
|
||||
}
|
||||
|
||||
if (!isSidebarPositionLeft) {
|
||||
|
@ -270,7 +270,7 @@ class NavigateDownAction extends BaseNavigationAction {
|
|||
}
|
||||
|
||||
if (isPanelPositionDown) {
|
||||
return Promise.resolve(this.navigateToPanel());
|
||||
return this.navigateToPanel();
|
||||
}
|
||||
|
||||
return Promise.resolve(false);
|
||||
|
|
|
@ -101,14 +101,12 @@ export abstract class TogglePanelAction extends Action {
|
|||
super(id, label, cssClass);
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
async run(): Promise<any> {
|
||||
if (this.isPanelFocused()) {
|
||||
this.layoutService.setPanelHidden(true);
|
||||
} else {
|
||||
this.panelService.openPanel(this.panelId, true);
|
||||
await this.panelService.openPanel(this.panelId, true);
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
private isPanelActive(): boolean {
|
||||
|
|
|
@ -182,10 +182,9 @@ export class PanelActivityAction extends ActivityAction {
|
|||
super(activity);
|
||||
}
|
||||
|
||||
run(event: any): Promise<any> {
|
||||
this.panelService.openPanel(this.activity.id, true);
|
||||
async run(event: any): Promise<any> {
|
||||
await this.panelService.openPanel(this.activity.id, true);
|
||||
this.activate();
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
setActivity(activity: IActivity): void {
|
||||
|
@ -225,11 +224,11 @@ export class SwitchPanelViewAction extends Action {
|
|||
super(id, name);
|
||||
}
|
||||
|
||||
run(offset: number): Promise<any> {
|
||||
async run(offset: number): Promise<any> {
|
||||
const pinnedPanels = this.panelService.getPinnedPanels();
|
||||
const activePanel = this.panelService.getActivePanel();
|
||||
if (!activePanel) {
|
||||
return Promise.resolve();
|
||||
return;
|
||||
}
|
||||
let targetPanelId: string | undefined;
|
||||
for (let i = 0; i < pinnedPanels.length; i++) {
|
||||
|
@ -239,9 +238,8 @@ export class SwitchPanelViewAction extends Action {
|
|||
}
|
||||
}
|
||||
if (typeof targetPanelId === 'string') {
|
||||
this.panelService.openPanel(targetPanelId, true);
|
||||
await this.panelService.openPanel(targetPanelId, true);
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
|||
this.compositeBar = this._register(this.instantiationService.createInstance(CompositeBar, this.getCachedPanels(), {
|
||||
icon: false,
|
||||
orientation: ActionsOrientation.HORIZONTAL,
|
||||
openComposite: (compositeId: string) => Promise.resolve(this.openPanel(compositeId, true)),
|
||||
openComposite: (compositeId: string) => this.openPanel(compositeId, true),
|
||||
getActivityAction: (compositeId: string) => this.getCompositeActions(compositeId).activityAction,
|
||||
getCompositePinnedAction: (compositeId: string) => this.getCompositeActions(compositeId).pinnedAction,
|
||||
getOnCompositeClickAction: (compositeId: string) => this.instantiationService.createInstance(PanelActivityAction, assertIsDefined(this.getPanel(compositeId))),
|
||||
|
@ -355,7 +355,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
|||
}
|
||||
}
|
||||
|
||||
openPanel(id: string, focus?: boolean): Panel | undefined {
|
||||
doOpenPanel(id: string, focus?: boolean): Panel | undefined {
|
||||
if (this.blockOpeningPanel) {
|
||||
return undefined; // Workaround against a potential race condition
|
||||
}
|
||||
|
@ -373,15 +373,15 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
|
|||
return this.openComposite(id, focus);
|
||||
}
|
||||
|
||||
async openPanelAsync(id?: string, focus?: boolean): Promise<Panel | undefined> {
|
||||
async openPanel(id?: string, focus?: boolean): Promise<Panel | undefined> {
|
||||
if (typeof id === 'string' && this.getPanel(id)) {
|
||||
return this.openPanel(id, focus);
|
||||
return this.doOpenPanel(id, focus);
|
||||
}
|
||||
|
||||
await this.extensionService.whenInstalledExtensionsRegistered();
|
||||
|
||||
if (typeof id === 'string' && this.getPanel(id)) {
|
||||
return this.openPanel(id, focus);
|
||||
return this.doOpenPanel(id, focus);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
|
|
@ -575,7 +575,7 @@ export class ViewsService extends Disposable implements IViewsService {
|
|||
if (location === ViewContainerLocation.Sidebar) {
|
||||
return this.viewletService.openViewlet(compositeId, focus);
|
||||
} else if (location === ViewContainerLocation.Panel) {
|
||||
return this.panelService.openPanel(compositeId, focus) as IPaneComposite;
|
||||
return this.panelService.openPanel(compositeId, focus) as Promise<IPaneComposite>;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
@ -443,9 +443,9 @@ export class Workbench extends Layout {
|
|||
restorePromises.push((async () => {
|
||||
mark('willRestorePanel');
|
||||
|
||||
const panel = await panelService.openPanelAsync(this.state.panel.panelToRestore);
|
||||
const panel = await panelService.openPanel(this.state.panel.panelToRestore!);
|
||||
if (!panel) {
|
||||
panelService.openPanel(Registry.as<PanelRegistry>(PanelExtensions.Panels).getDefaultPanelId()); // fallback to default panel as needed
|
||||
await panelService.openPanel(Registry.as<PanelRegistry>(PanelExtensions.Panels).getDefaultPanelId()); // fallback to default panel as needed
|
||||
}
|
||||
|
||||
mark('didRestorePanel');
|
||||
|
|
|
@ -28,9 +28,9 @@ import { IEditorInput } from 'vs/workbench/common/editor';
|
|||
import type { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
|
||||
function getBulkEditPane(panelService: IPanelService): BulkEditPane | undefined {
|
||||
async function getBulkEditPane(panelService: IPanelService): Promise<BulkEditPane | undefined> {
|
||||
let view: ViewPane | undefined;
|
||||
const activePanel = panelService.openPanel(BulkEditPane.ID, true);
|
||||
const activePanel = await panelService.openPanel(BulkEditPane.ID, true);
|
||||
if (activePanel instanceof PaneCompositePanel) {
|
||||
view = activePanel.getViewPaneContainer().getView(BulkEditPane.ID);
|
||||
}
|
||||
|
@ -51,11 +51,11 @@ class UXState {
|
|||
this._activePanel = _panelService.getActivePanel()?.getId();
|
||||
}
|
||||
|
||||
restore(): void {
|
||||
async restore(): Promise<void> {
|
||||
|
||||
// (1) restore previous panel
|
||||
if (typeof this._activePanel === 'string') {
|
||||
this._panelService.openPanel(this._activePanel);
|
||||
await this._panelService.openPanel(this._activePanel);
|
||||
} else {
|
||||
this._panelService.hideActivePanel();
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ class BulkEditPreviewContribution {
|
|||
|
||||
// the actual work...
|
||||
try {
|
||||
const view = getBulkEditPane(this._panelService);
|
||||
const view = await getBulkEditPane(this._panelService);
|
||||
if (!view) {
|
||||
return edit;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ class BulkEditPreviewContribution {
|
|||
} finally {
|
||||
// restore UX state
|
||||
if (this._activeSession === session) {
|
||||
this._activeSession.uxState.restore();
|
||||
await this._activeSession.uxState.restore();
|
||||
this._activeSession.cts.dispose();
|
||||
this._ctxEnabled.set(false);
|
||||
this._activeSession = undefined;
|
||||
|
@ -174,9 +174,9 @@ registerAction2(class ApplyAction extends Action2 {
|
|||
});
|
||||
}
|
||||
|
||||
run(accessor: ServicesAccessor): any {
|
||||
async run(accessor: ServicesAccessor): Promise<any> {
|
||||
const panelService = accessor.get(IPanelService);
|
||||
const view = getBulkEditPane(panelService);
|
||||
const view = await getBulkEditPane(panelService);
|
||||
if (view) {
|
||||
view.accept();
|
||||
}
|
||||
|
@ -203,9 +203,9 @@ registerAction2(class DiscardAction extends Action2 {
|
|||
});
|
||||
}
|
||||
|
||||
run(accessor: ServicesAccessor): void | Promise<void> {
|
||||
async run(accessor: ServicesAccessor): Promise<void> {
|
||||
const panelService = accessor.get(IPanelService);
|
||||
const view = getBulkEditPane(panelService);
|
||||
const view = await getBulkEditPane(panelService);
|
||||
if (view) {
|
||||
view.discard();
|
||||
}
|
||||
|
@ -234,9 +234,9 @@ registerAction2(class ToggleAction extends Action2 {
|
|||
});
|
||||
}
|
||||
|
||||
run(accessor: ServicesAccessor): void | Promise<void> {
|
||||
async run(accessor: ServicesAccessor): Promise<void> {
|
||||
const panelService = accessor.get(IPanelService);
|
||||
const view = getBulkEditPane(panelService);
|
||||
const view = await getBulkEditPane(panelService);
|
||||
if (view) {
|
||||
view.toggleChecked();
|
||||
}
|
||||
|
@ -263,9 +263,9 @@ registerAction2(class GroupByFile extends Action2 {
|
|||
});
|
||||
}
|
||||
|
||||
run(accessor: ServicesAccessor): void | Promise<void> {
|
||||
async run(accessor: ServicesAccessor): Promise<void> {
|
||||
const panelService = accessor.get(IPanelService);
|
||||
const view = getBulkEditPane(panelService);
|
||||
const view = await getBulkEditPane(panelService);
|
||||
if (view) {
|
||||
view.groupByFile();
|
||||
}
|
||||
|
@ -290,9 +290,9 @@ registerAction2(class GroupByType extends Action2 {
|
|||
});
|
||||
}
|
||||
|
||||
run(accessor: ServicesAccessor): void | Promise<void> {
|
||||
async run(accessor: ServicesAccessor): Promise<void> {
|
||||
const panelService = accessor.get(IPanelService);
|
||||
const view = getBulkEditPane(panelService);
|
||||
const view = await getBulkEditPane(panelService);
|
||||
if (view) {
|
||||
view.groupByType();
|
||||
}
|
||||
|
@ -316,9 +316,9 @@ registerAction2(class ToggleGrouping extends Action2 {
|
|||
});
|
||||
}
|
||||
|
||||
run(accessor: ServicesAccessor): void | Promise<void> {
|
||||
async run(accessor: ServicesAccessor): Promise<void> {
|
||||
const panelService = accessor.get(IPanelService);
|
||||
const view = getBulkEditPane(panelService);
|
||||
const view = await getBulkEditPane(panelService);
|
||||
if (view) {
|
||||
view.toggleGrouping();
|
||||
}
|
||||
|
|
|
@ -223,11 +223,11 @@ export class CommentsPanel extends Panel {
|
|||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: 'workbench.action.focusCommentsPanel',
|
||||
handler: (accessor) => {
|
||||
handler: async (accessor) => {
|
||||
const panelService = accessor.get(IPanelService);
|
||||
const panels = panelService.getPanels();
|
||||
if (panels.some(panelIdentifier => panelIdentifier.id === COMMENTS_PANEL_ID)) {
|
||||
panelService.openPanel(COMMENTS_PANEL_ID, true);
|
||||
await panelService.openPanel(COMMENTS_PANEL_ID, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -68,7 +68,7 @@ export class DebugTaskRunner {
|
|||
return TaskRunResult.Success;
|
||||
}
|
||||
if (onTaskErrors === 'showErrors') {
|
||||
this.panelService.openPanel(Constants.MARKERS_PANEL_ID);
|
||||
await this.panelService.openPanel(Constants.MARKERS_PANEL_ID);
|
||||
return Promise.resolve(TaskRunResult.Failure);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ export class DebugTaskRunner {
|
|||
return TaskRunResult.Success;
|
||||
}
|
||||
|
||||
this.panelService.openPanel(Constants.MARKERS_PANEL_ID);
|
||||
await this.panelService.openPanel(Constants.MARKERS_PANEL_ID);
|
||||
return Promise.resolve(TaskRunResult.Failure);
|
||||
} catch (err) {
|
||||
await onError(err.message, [this.taskService.configureAction()]);
|
||||
|
|
|
@ -56,8 +56,8 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|||
weight: KeybindingWeight.WorkbenchContrib,
|
||||
when: undefined,
|
||||
primary: undefined,
|
||||
handler: (accessor, args: any) => {
|
||||
accessor.get(IPanelService).openPanel(Constants.MARKERS_PANEL_ID);
|
||||
handler: async (accessor, args: any) => {
|
||||
await accessor.get(IPanelService).openPanel(Constants.MARKERS_PANEL_ID);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -314,13 +314,13 @@ MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
|
|||
order: 4
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand('workbench.actions.view.toggleProblems', accessor => {
|
||||
CommandsRegistry.registerCommand('workbench.actions.view.toggleProblems', async (accessor) => {
|
||||
const panelService = accessor.get(IPanelService);
|
||||
const panel = accessor.get(IPanelService).getActivePanel();
|
||||
if (panel && panel.getId() === Constants.MARKERS_PANEL_ID) {
|
||||
panelService.hideActivePanel();
|
||||
} else {
|
||||
panelService.openPanel(Constants.MARKERS_PANEL_ID, true);
|
||||
await panelService.openPanel(Constants.MARKERS_PANEL_ID, true);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -40,8 +40,7 @@ export class ShowProblemsPanelAction extends Action {
|
|||
}
|
||||
|
||||
public run(): Promise<any> {
|
||||
this.panelService.openPanel(Constants.MARKERS_PANEL_ID, true);
|
||||
return Promise.resolve();
|
||||
return this.panelService.openPanel(Constants.MARKERS_PANEL_ID, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -413,12 +413,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
|||
return this.runShowTasks();
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand('workbench.action.tasks.toggleProblems', () => {
|
||||
CommandsRegistry.registerCommand('workbench.action.tasks.toggleProblems', async () => {
|
||||
const panel = this.panelService.getActivePanel();
|
||||
if (panel && panel.getId() === Constants.MARKERS_PANEL_ID) {
|
||||
this.layoutService.setPanelHidden(true);
|
||||
} else {
|
||||
this.panelService.openPanel(Constants.MARKERS_PANEL_ID, true);
|
||||
await this.panelService.openPanel(Constants.MARKERS_PANEL_ID, true);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -413,10 +413,10 @@ export class TerminalService implements ITerminalService {
|
|||
}
|
||||
|
||||
public showPanel(focus?: boolean): Promise<void> {
|
||||
return new Promise<void>((complete) => {
|
||||
return new Promise<void>(async (complete) => {
|
||||
const panel = this._panelService.getActivePanel();
|
||||
if (!panel || panel.getId() !== TERMINAL_PANEL_ID) {
|
||||
this._panelService.openPanel(TERMINAL_PANEL_ID, focus);
|
||||
await this._panelService.openPanel(TERMINAL_PANEL_ID, focus);
|
||||
if (focus) {
|
||||
// Do the focus call asynchronously as going through the
|
||||
// command palette will force editor focus
|
||||
|
|
|
@ -28,12 +28,7 @@ export interface IPanelService {
|
|||
/**
|
||||
* Opens a panel with the given identifier and pass keyboard focus to it if specified.
|
||||
*/
|
||||
openPanel(id: string, focus?: boolean): IPanel | undefined;
|
||||
|
||||
/**
|
||||
* Opens a panel with the given identifier and pass keyboard focus to it if specified.
|
||||
*/
|
||||
openPanelAsync(id?: string, focus?: boolean): Promise<IPanel | undefined>;
|
||||
openPanel(id?: string, focus?: boolean): Promise<IPanel | undefined>;
|
||||
|
||||
/**
|
||||
* Returns the current active panel or null if none
|
||||
|
|
|
@ -520,11 +520,7 @@ export class TestPanelService implements IPanelService {
|
|||
onDidPanelOpen = new Emitter<{ panel: IPanel, focus: boolean }>().event;
|
||||
onDidPanelClose = new Emitter<IPanel>().event;
|
||||
|
||||
openPanel(id: string, focus?: boolean): undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async openPanelAsync(id?: string, focus?: boolean): Promise<undefined> {
|
||||
async openPanel(id?: string, focus?: boolean): Promise<undefined> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue