Skip to content

Commit

Permalink
Make the session's pane its own seperate view container now that plot…
Browse files Browse the repository at this point in the history
…s and variables go into it. (posit-dev#3129)
  • Loading branch information
nstrayer authored May 14, 2024
1 parent acf6ffc commit 359215e
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 38 deletions.
4 changes: 4 additions & 0 deletions build/lib/i18n.resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@
"name": "vs/workbench/contrib/positronVariables",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/contrib/positronSession",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/contrib/positronHelp",
"project": "vscode-workbench"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWo
import { Extensions as ViewContainerExtensions, IViewsRegistry } from 'vs/workbench/common/views';
import { registerAction2 } from 'vs/platform/actions/common/actions';
import { PlotsRefreshAction } from 'vs/workbench/contrib/positronPlots/browser/positronPlotsActions';
import { VIEW_CONTAINER } from 'vs/workbench/contrib/positronVariables/browser/positronVariables.contribution';
import { POSITRON_SESSION_CONTAINER } from 'vs/workbench/contrib/positronSession/browser/positronSessionContainer';

// Register the Positron plots service.
registerSingleton(IPositronPlotsService, PositronPlotsService, InstantiationType.Delayed);
Expand Down Expand Up @@ -48,7 +48,7 @@ Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).registerViews
}
}
],
VIEW_CONTAINER
POSITRON_SESSION_CONTAINER
);

class PositronPlotsContribution extends Disposable implements IWorkbenchContribution {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2024 Posit Software, PBC. All rights reserved.
*--------------------------------------------------------------------------------------------*/

import * as nls from 'vs/nls';
import { Registry } from 'vs/platform/registry/common/platform';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { ViewContainer, IViewContainersRegistry, ViewContainerLocation, Extensions as ViewContainerExtensions } from 'vs/workbench/common/views';
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
import { Codicon } from 'vs/base/common/codicons';

export const POSITRON_SESSION_VIEW_ID = 'workbench.panel.positronSession';

// The Positron variables view icon.
export const positronSessionViewIcon = registerIcon(
'positron-session-view-icon',
Codicon.positronVariablesView,
nls.localize('positronSessionViewIcon', 'View icon of the Positron session view.')
);


/**
* A view container for holding views related to the positron session.
* E.g. variables and plots.
*/
export const POSITRON_SESSION_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(
ViewContainerExtensions.ViewContainersRegistry
).registerViewContainer(
{
id: POSITRON_SESSION_VIEW_ID,
title: {
value: nls.localize('positron.session', "Session"),
original: 'Session'
},
icon: positronSessionViewIcon,
order: 1,
ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [POSITRON_SESSION_VIEW_ID, { mergeViewWithContainerWhenSingleView: true }]),
storageId: POSITRON_SESSION_VIEW_ID,
hideIfEmpty: false,
},
ViewContainerLocation.AuxiliaryBar,
{
doNotRegisterOpenCommand: true,
isDefault: true
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,26 @@
*--------------------------------------------------------------------------------------------*/

import * as nls from 'vs/nls';
import { Codicon } from 'vs/base/common/codicons';
import { Disposable } from 'vs/base/common/lifecycle';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { Registry } from 'vs/platform/registry/common/platform';
import { registerAction2 } from 'vs/platform/actions/common/actions';
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
import { PositronVariablesFocused } from 'vs/workbench/common/contextkeys';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { PositronVariablesViewPane } from 'vs/workbench/contrib/positronVariables/browser/positronVariablesView';
import { PositronVariablesRefreshAction } from 'vs/workbench/contrib/positronVariables/browser/positronVariablesActions';
import { IPositronVariablesService } from 'vs/workbench/services/positronVariables/common/interfaces/positronVariablesService';
import { ICommandAndKeybindingRule, KeybindingWeight, KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { ViewContainer, IViewContainersRegistry, ViewContainerLocation, Extensions as ViewContainerExtensions, IViewsRegistry } from 'vs/workbench/common/views';
import { Extensions as ViewContainerExtensions, IViewsRegistry } from 'vs/workbench/common/views';
import { POSITRON_VARIABLES_COLLAPSE, POSITRON_VARIABLES_COPY_AS_HTML, POSITRON_VARIABLES_COPY_AS_TEXT, POSITRON_VARIABLES_EXPAND } from 'vs/workbench/contrib/positronVariables/browser/positronVariablesIdentifiers';
import { POSITRON_SESSION_CONTAINER, positronSessionViewIcon } from 'vs/workbench/contrib/positronSession/browser/positronSessionContainer';

// The Positron variables view identifier.
export const POSITRON_VARIABLES_VIEW_ID = 'workbench.panel.positronVariables';

// The Positron variables view icon.
const positronVariablesViewIcon = registerIcon(
'positron-variables-view-icon',
Codicon.positronVariablesView,
nls.localize('positronVariablesViewIcon', 'View icon of the Positron variables view.')
);

// Register the Positron variables view container.
export const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(
ViewContainerExtensions.ViewContainersRegistry
).registerViewContainer(
{
id: POSITRON_VARIABLES_VIEW_ID,
title: {
value: nls.localize('positron.session', "Session"),
original: 'Session'
},
icon: positronVariablesViewIcon,
order: 1,
ctorDescriptor: new SyncDescriptor(ViewPaneContainer, [POSITRON_VARIABLES_VIEW_ID, { mergeViewWithContainerWhenSingleView: true }]),
storageId: POSITRON_VARIABLES_VIEW_ID,
hideIfEmpty: false,
},
ViewContainerLocation.AuxiliaryBar,
{
doNotRegisterOpenCommand: true,
isDefault: true
}
);

// Register the Positron variables view.
Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).registerViews(
[
Expand All @@ -67,7 +35,7 @@ Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).registerViews
ctorDescriptor: new SyncDescriptor(PositronVariablesViewPane),
canToggleVisibility: false,
canMoveView: true,
containerIcon: positronVariablesViewIcon,
containerIcon: positronSessionViewIcon,
openCommandActionDescriptor: {
id: 'workbench.action.positron.toggleVariables',
mnemonicTitle: nls.localize({ key: 'miToggleVariables', comment: ['&& denotes a mnemonic'] }, "&&Variables"),
Expand All @@ -78,7 +46,7 @@ Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).registerViews
}
}
],
VIEW_CONTAINER
POSITRON_SESSION_CONTAINER
);

/**
Expand Down

0 comments on commit 359215e

Please sign in to comment.