notebook open layout settings.

This commit is contained in:
rebornix 2021-05-24 14:03:03 -07:00
parent 41d869f551
commit 8a41d85d1b
No known key found for this signature in database
GPG key ID: 181FC90D15393C20
3 changed files with 37 additions and 3 deletions

View file

@ -24,6 +24,7 @@ import { ICellRange, isICellRange } from 'vs/workbench/contrib/notebook/common/n
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
import * as icons from 'vs/workbench/contrib/notebook/browser/notebookIcons';
import { NotebookEditorInput } from 'vs/workbench/contrib/notebook/common/notebookEditorInput';
import { EditorsOrder, IEditorCommandsContext } from 'vs/workbench/common/editor';
@ -1767,6 +1768,32 @@ registerAction2(class ExpandCellOuputAction extends ChangeNotebookCellMetadataAc
}
});
registerAction2(class NotebookConfigureLayoutAction extends Action2 {
constructor() {
super({
id: 'workbench.notebook.layout.configure',
title: localize('workbench.notebook.layout.configure.label', "Configure Notebook Editor Layout Settings"),
f1: true,
category: NOTEBOOK_ACTIONS_CATEGORY,
menu: [
{
id: MenuId.EditorTitle,
group: 'notebookLayout',
when: ContextKeyExpr.notEquals('config.notebook.globalToolbar', true)
},
{
id: MenuId.NotebookToolbar,
group: 'notebookLayout',
when: ContextKeyExpr.equals('config.notebook.globalToolbar', true)
}
]
});
}
run(accessor: ServicesAccessor): void {
accessor.get(IPreferencesService).openSettings(false, '@tag:notebookLayout');
}
});
CommandsRegistry.registerCommand('_resolveNotebookContentProvider', (accessor, args): {
viewType: string;
displayName: string;

View file

@ -186,7 +186,7 @@ export class NotebookEditorToolbar extends Disposable {
});
const primaryRightGroup = groups.find(group => /^status/.test(group[0]));
const primaryRightActions = primaryRightGroup ? primaryRightGroup[1] : [];
const secondaryActions = groups.filter(group => /^navigation/.test(group[0]) && /^status/.test(group[0])).reduce((prev: (MenuItemAction | SubmenuItemAction)[], curr) => { prev.push(...curr[1]); return prev; }, []);
const secondaryActions = groups.filter(group => !/^navigation/.test(group[0]) && !/^status/.test(group[0])).reduce((prev: (MenuItemAction | SubmenuItemAction)[], curr) => { prev.push(...curr[1]); return prev; }, []);
this._notebookLeftToolbar.setActions(primaryActions, secondaryActions);
this._notebookRightToolbar.setActions(primaryRightActions, []);

View file

@ -135,9 +135,16 @@ registerAction2(class ToggleLineNumberAction extends Action2 {
precondition: NOTEBOOK_EDITOR_FOCUSED,
menu: [{
id: MenuId.EditorTitle,
group: 'LineNumber',
group: 'notebookLayout',
order: 0,
when: NOTEBOOK_IS_ACTIVE_EDITOR
when: ContextKeyExpr.and(
NOTEBOOK_IS_ACTIVE_EDITOR,
ContextKeyExpr.notEquals('config.notebook.globalToolbar', true)
)
}, {
id: MenuId.NotebookToolbar,
group: 'notebookLayout',
when: ContextKeyExpr.equals('config.notebook.globalToolbar', true)
}],
category: NOTEBOOK_ACTIONS_CATEGORY,
f1: true,