Skip to content

Commit

Permalink
move view into debug container
Browse files Browse the repository at this point in the history
  • Loading branch information
amunger committed Nov 17, 2023
1 parent 449c95f commit 9b313c3
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 66 deletions.
3 changes: 3 additions & 0 deletions src/vs/workbench/contrib/debug/browser/debug.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ import { BREAKPOINTS_VIEW_ID, BREAKPOINT_EDITOR_CONTRIBUTION_ID, CALLSTACK_VIEW_
import { DebugContentProvider } from 'vs/workbench/contrib/debug/common/debugContentProvider';
import { DebugLifecycle } from 'vs/workbench/contrib/debug/common/debugLifecycle';
import { DisassemblyViewInput } from 'vs/workbench/contrib/debug/common/disassemblyViewInput';
import { NotebookVariablesView } from 'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView';
import { NOTEBOOK_KERNEL } from 'vs/workbench/contrib/notebook/common/notebookContextKeys';
import { launchSchemaId } from 'vs/workbench/services/configuration/common/configuration';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';

Expand Down Expand Up @@ -413,6 +415,7 @@ viewsRegistry.registerViews([{ id: CALLSTACK_VIEW_ID, name: nls.localize2('callS
viewsRegistry.registerViews([{ id: BREAKPOINTS_VIEW_ID, name: nls.localize2('breakpoints', "Breakpoints"), containerIcon: icons.breakpointsViewIcon, ctorDescriptor: new SyncDescriptor(BreakpointsView), order: 40, weight: 20, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusBreakpointsView' }, when: ContextKeyExpr.or(CONTEXT_BREAKPOINTS_EXIST, CONTEXT_DEBUG_UX.isEqualTo('default'), CONTEXT_HAS_DEBUGGED) }], viewContainer);
viewsRegistry.registerViews([{ id: WelcomeView.ID, name: WelcomeView.LABEL, containerIcon: icons.runViewIcon, ctorDescriptor: new SyncDescriptor(WelcomeView), order: 1, weight: 40, canToggleVisibility: true, when: CONTEXT_DEBUG_UX.isEqualTo('simple') }], viewContainer);
viewsRegistry.registerViews([{ id: LOADED_SCRIPTS_VIEW_ID, name: nls.localize2('loadedScripts', "Loaded Scripts"), containerIcon: icons.loadedScriptsViewIcon, ctorDescriptor: new SyncDescriptor(LoadedScriptsView), order: 35, weight: 5, canToggleVisibility: true, canMoveView: true, collapsed: true, when: ContextKeyExpr.and(CONTEXT_LOADED_SCRIPTS_SUPPORTED, CONTEXT_DEBUG_UX.isEqualTo('default')) }], viewContainer);
viewsRegistry.registerViews([{ id: LOADED_SCRIPTS_VIEW_ID, name: nls.localize2('notebookVariables', "Notebook Variables"), containerIcon: icons.variablesViewIcon, ctorDescriptor: new SyncDescriptor(NotebookVariablesView), order: 50, weight: 5, canToggleVisibility: true, canMoveView: true, collapsed: true, when: NOTEBOOK_KERNEL }], viewContainer);

// Register disassembly view

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IViewPaneOptions, ViewPane } from 'vs/workbench/browser/parts/views/viewPane';
import { IViewDescriptor, IViewDescriptorService } from 'vs/workbench/common/views';
import { getNotebookEditorFromEditorPane } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import { variablesViewIcon } from 'vs/workbench/contrib/notebook/browser/notebookIcons';
import { INotebookKernelService } from 'vs/workbench/contrib/notebook/common/notebookKernelService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';

export class NotebookVariablesView extends ViewPane {

export class VariablesPanel extends ViewPane {

static readonly ID = 'variablesView';
static readonly TITLE: ILocalizedString = nls.localize2('remote.tunnel', "Ports");
static readonly ID = 'notebookVariablesView';
static readonly TITLE: ILocalizedString = nls.localize2('notebook.notebookVariables', "Notebook Variables");

constructor(
options: IViewPaneOptions,
@IEditorService private readonly editorService: IEditorService,
@INotebookKernelService private readonly notebookKernelService: INotebookKernelService,
@IKeybindingService keybindingService: IKeybindingService,
@IContextMenuService contextMenuService: IContextMenuService,
@IContextKeyService contextKeyService: IContextKeyService,
Expand All @@ -41,24 +46,35 @@ export class VariablesPanel extends ViewPane {
) {
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);

this._register(this.editorService.onDidActiveEditorChange(this.handleActiveEditorChange));
}

private handleActiveEditorChange() {
const activeEditorPane = this.editorService.activeEditorPane;
if (activeEditorPane && activeEditorPane.getId() === 'workbench.editor.notebook') {
const notebookModel = getNotebookEditorFromEditorPane(activeEditorPane)?.textModel;
if (notebookModel) {
const selectedKernel = this.notebookKernelService.getMatchingKernel(notebookModel).selected;
console.log(selectedKernel?.id);
}
}
}
}

export class VariablesPanelDescriptor implements IViewDescriptor {
readonly id = VariablesPanel.ID;
readonly name: ILocalizedString = VariablesPanel.TITLE;
readonly ctorDescriptor: SyncDescriptor<VariablesPanel>;
readonly id = NotebookVariablesView.ID;
readonly name: ILocalizedString = NotebookVariablesView.TITLE;
readonly ctorDescriptor: SyncDescriptor<NotebookVariablesView>;
readonly canToggleVisibility = true;
readonly hideByDefault = false;
// group is not actually used for views that are not extension contributed. Use order instead.
readonly group = 'details@0';
// -500 comes from the remote explorer viewOrderDelegate
readonly order = -500;
readonly order = 500;
readonly remoteAuthority?: string | string[];
readonly canMoveView = true;
readonly containerIcon = variablesViewIcon;

constructor() {
this.ctorDescriptor = new SyncDescriptor(VariablesPanel);
this.ctorDescriptor = new SyncDescriptor(NotebookVariablesView);
}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { Disposable } from 'vs/base/common/lifecycle';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { Registry } from 'vs/platform/registry/common/platform';
import { IViewContainersRegistry } from 'vs/workbench/common/views';
import { VIEWLET_ID as debugContainerId } from 'vs/workbench/contrib/debug/common/debug';


export class NotebookVariables extends Disposable implements IWorkbenchContribution {

constructor() {
super();
this.enableVariablesView();
}

private async enableVariablesView() {
const viewEnabled = true;

if (viewEnabled) {
const debugViewContainer = Registry.as<IViewContainersRegistry>('workbench.registry.view.containers').get(debugContainerId);

if (debugViewContainer) {
// const variablesPanelDescriptor = new VariablesPanelDescriptor();
// const viewsRegistry = Registry.as<IViewsRegistry>(Extensions.ViewsRegistry);

// viewsRegistry.registerViews([variablesPanelDescriptor], debugViewContainer);
}

} else {
// this.contextKeyListener = this.contextKeyService.onDidChangeContext(e => {
// if (e.affectsSome()) {
// this.enableVariablesView();
// }
// });
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ import { runAccessibilityHelpAction, showAccessibleOutput } from 'vs/workbench/c
import { IAccessibleViewService } from 'vs/workbench/contrib/accessibility/browser/accessibleView';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { AccessibilityHelpAction, AccessibleViewAction } from 'vs/workbench/contrib/accessibility/browser/accessibleViewActions';
import { NotebookVariables } from 'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/variablesView';

/*--------------------------------------------------------------------------------------------- */

Registry.as<IEditorPaneRegistry>(EditorExtensions.EditorPane).registerEditorPane(
Expand Down Expand Up @@ -718,6 +720,7 @@ workbenchContributionsRegistry.registerWorkbenchContribution(NotebookLanguageSel
workbenchContributionsRegistry.registerWorkbenchContribution(SimpleNotebookWorkingCopyEditorHandler, LifecyclePhase.Ready);
workbenchContributionsRegistry.registerWorkbenchContribution(NotebookAccessibilityHelpContribution, LifecyclePhase.Eventually);
workbenchContributionsRegistry.registerWorkbenchContribution(NotebookAccessibleViewContribution, LifecyclePhase.Eventually);
workbenchContributionsRegistry.registerWorkbenchContribution(NotebookVariables, LifecyclePhase.Eventually);

registerSingleton(INotebookService, NotebookService, InstantiationType.Delayed);
registerSingleton(INotebookEditorWorkerService, NotebookEditorWorkerServiceImpl, InstantiationType.Delayed);
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/contrib/notebook/browser/notebookIcons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ export const copyIcon = registerIcon('notebook-copy', Codicon.copy, localize('co
export const previousChangeIcon = registerIcon('notebook-diff-editor-previous-change', Codicon.arrowUp, localize('previousChangeIcon', 'Icon for the previous change action in the diff editor.'));
export const nextChangeIcon = registerIcon('notebook-diff-editor-next-change', Codicon.arrowDown, localize('nextChangeIcon', 'Icon for the next change action in the diff editor.'));

export const variablesViewIcon = registerIcon('variables-view-icon', Codicon.debugAlt, localize('variablesViewIcon', 'View icon of the variables view.'));

0 comments on commit 9b313c3

Please sign in to comment.