Skip to content

Commit 3f84c87

Browse files
committed
move inspect notebook layout into developer category
1 parent 408ad5d commit 3f84c87

1 file changed

Lines changed: 25 additions & 4 deletions

File tree

src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,15 +1498,36 @@ registerAction2(class extends NotebookCellAction {
14981498
}
14991499
});
15001500

1501-
registerAction2(class extends NotebookCellAction {
1501+
registerAction2(class extends Action2 {
15021502
constructor() {
15031503
super({
15041504
id: 'notebook.inspectLayout',
1505-
title: localize('notebookActions.inspectLayout', "Inspect Layout")
1505+
title: localize('notebookActions.inspectLayout', "Inspect Notebook Layout"),
1506+
category: { value: localize({ key: 'developer', comment: ['A developer on Code itself or someone diagnosing issues in Code'] }, "Developer"), original: 'Developer' },
1507+
f1: true
15061508
});
15071509
}
15081510

1509-
async runWithContext(accessor: ServicesAccessor, context: INotebookCellActionContext): Promise<void> {
1510-
context.notebookEditor.viewModel!.inspectLayout();
1511+
protected getActiveEditorContext(accessor: ServicesAccessor): INotebookActionContext | undefined {
1512+
const editorService = accessor.get(IEditorService);
1513+
1514+
const editor = getActiveNotebookEditor(editorService);
1515+
if (!editor) {
1516+
return;
1517+
}
1518+
1519+
const activeCell = editor.getActiveCell();
1520+
return {
1521+
cell: activeCell,
1522+
notebookEditor: editor
1523+
};
1524+
}
1525+
1526+
run(accessor: ServicesAccessor) {
1527+
const activeEditorContext = this.getActiveEditorContext(accessor);
1528+
1529+
if (activeEditorContext) {
1530+
activeEditorContext.notebookEditor.viewModel!.inspectLayout();
1531+
}
15111532
}
15121533
});

0 commit comments

Comments
 (0)