Skip to content

Commit f5ab698

Browse files
authored
Replace newNotebook with notebookEditor in commands (microsoft#13772)
1 parent 687363d commit f5ab698

File tree

5 files changed

+18
-30
lines changed

5 files changed

+18
-30
lines changed

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -861,18 +861,18 @@
861861
"category": "Python"
862862
},
863863
{
864-
"command": "python.datascience.newNotebook.removeallcells",
865-
"title": "%python.command.python.datascience.newNotebook.removeallcells.title%",
864+
"command": "python.datascience.notebookeditor.removeallcells",
865+
"title": "%python.command.python.datascience.notebookeditor.removeallcells.title%",
866866
"category": "Python"
867867
},
868868
{
869-
"command": "python.datascience.newNotebook.expandallcells",
870-
"title": "%python.command.python.datascience.newNotebook.expandallcells.title%",
869+
"command": "python.datascience.notebookeditor.expandallcells",
870+
"title": "%python.command.python.datascience.notebookeditor.expandallcells.title%",
871871
"category": "Python"
872872
},
873873
{
874-
"command": "python.datascience.newNotebook.collapseallcells",
875-
"title": "%python.command.python.datascience.newNotebook.collapseallcells.title%",
874+
"command": "python.datascience.notebookeditor.collapseallcells",
875+
"title": "%python.command.python.datascience.notebookeditor.collapseallcells.title%",
876876
"category": "Python"
877877
},
878878
{
@@ -1435,20 +1435,20 @@
14351435
"when": "python.datascience.isnativeactive && python.datascience.featureenabled && python.datascience.isnotebooktrusted"
14361436
},
14371437
{
1438-
"command": "python.datascience.newNotebook.removeallcells",
1439-
"title": "%python.command.python.datascience.newNotebook.removeallcells.title%",
1438+
"command": "python.datascience.notebookeditor.removeallcells",
1439+
"title": "%python.command.python.datascience.removeallcells.title%",
14401440
"category": "Python",
14411441
"when": "python.datascience.featureenabled && notebookEditorFocused"
14421442
},
14431443
{
1444-
"command": "python.datascience.newNotebook.expandallcells",
1445-
"title": "%python.command.python.datascience.newNotebook.expandallcells.title%",
1444+
"command": "python.datascience.notebookeditor.expandallcells",
1445+
"title": "%python.command.python.datascience.expandallcells.title%",
14461446
"category": "Python",
14471447
"when": "python.datascience.featureenabled && notebookEditorFocused"
14481448
},
14491449
{
1450-
"command": "python.datascience.newNotebook.collapseallcells",
1451-
"title": "%python.command.python.datascience.newNotebook.collapseallcells.title%",
1450+
"command": "python.datascience.notebookeditor.collapseallcells",
1451+
"title": "%python.command.python.datascience.collapseallcells.title%",
14521452
"category": "Python",
14531453
"when": "python.datascience.featureenabled && notebookEditorFocused"
14541454
},

package.nls.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@
112112
"python.command.python.datascience.addcellbelow.title": "Add Empty Cell to File",
113113
"python.command.python.datascience.scrolltocell.title": "Scroll Cell Into View",
114114
"python.command.python.datascience.createnewnotebook.title": "Create New Blank Jupyter Notebook",
115-
"python.command.python.datascience.newNotebook.removeallcells.title": "Remove all Cells",
116-
"python.command.python.datascience.newNotebook.expandallcells.title": "Expand all Cells",
117-
"python.command.python.datascience.newNotebook.collapseallcells.title": "Collapse all Cells",
118115
"python.command.python.startPage.open.title": "Open Start Page",
119116
"python.command.python.datascience.selectJupyterInterpreter.title": "Select Interpreter to start Jupyter server",
120117
"Datascience.currentlySelectedJupyterInterpreterForPlaceholder": "current: {0}",

src/client/common/application/commands.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgu
202202
[DSCommands.LatestExtension]: [string];
203203
[DSCommands.EnableLoadingWidgetsFrom3rdPartySource]: [undefined | never];
204204
[DSCommands.TrustNotebook]: [undefined | never | Uri];
205-
[DSCommands.NewNotebookRemoveAllCells]: [];
206-
[DSCommands.NewNotebookExpandAllCells]: [];
207-
[DSCommands.NewNotebookCollapseAllCells]: [];
205+
[DSCommands.NotebookEditorExpandAllCells]: [];
206+
[DSCommands.NotebookEditorCollapseAllCells]: [];
208207
}

src/client/datascience/commands/notebookCommands.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ export class NotebookCommands implements IDisposable {
3232
this.disposables.push(
3333
this.commandManager.registerCommand(Commands.SwitchJupyterKernel, this.switchKernel, this),
3434
this.commandManager.registerCommand(Commands.SetJupyterKernel, this.setKernel, this),
35-
this.commandManager.registerCommand(Commands.NewNotebookCollapseAllCells, this.collapseAll, this),
36-
this.commandManager.registerCommand(Commands.NewNotebookExpandAllCells, this.expandAll, this),
37-
this.commandManager.registerCommand(Commands.NewNotebookRemoveAllCells, this.removeAll, this)
35+
this.commandManager.registerCommand(Commands.NotebookEditorCollapseAllCells, this.collapseAll, this),
36+
this.commandManager.registerCommand(Commands.NotebookEditorExpandAllCells, this.expandAll, this)
3837
);
3938
}
4039
public dispose() {
@@ -53,12 +52,6 @@ export class NotebookCommands implements IDisposable {
5352
}
5453
}
5554

56-
private removeAll() {
57-
if (this.notebookEditorProvider.activeEditor) {
58-
this.notebookEditorProvider.activeEditor.removeAllCells();
59-
}
60-
}
61-
6255
private async switchKernel(options: ISwitchKernelOptions | undefined) {
6356
// If no identity, spec, or resource, look at the active editor or interactive window.
6457
// Only one is possible to be active at any point in time

src/client/datascience/constants.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,8 @@ export namespace Commands {
109109
export const TrustNotebook = 'python.datascience.notebookeditor.trust';
110110
export const EnableLoadingWidgetsFrom3rdPartySource =
111111
'python.datascience.enableLoadingWidgetScriptsFromThirdPartySource';
112-
export const NewNotebookRemoveAllCells = 'python.datascience.newNotebook.removeallcells';
113-
export const NewNotebookExpandAllCells = 'python.datascience.newNotebook.expandallcells';
114-
export const NewNotebookCollapseAllCells = 'python.datascience.newNotebook.collapseallcells';
112+
export const NotebookEditorExpandAllCells = 'python.datascience.notebookeditor.expandallcells';
113+
export const NotebookEditorCollapseAllCells = 'python.datascience.notebookeditor.collapseallcells';
115114
}
116115

117116
export namespace CodeLensCommands {

0 commit comments

Comments
 (0)