Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop duplicate commands #15482

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -636,18 +636,6 @@
"category": "Notebook",
"enablement": "!jupyter.webExtension"
},
{
"command": "jupyter.notebookeditor.expandallcells",
"title": "%jupyter.command.jupyter.notebookeditor.expandallcells.title%",
"category": "Notebook",
"enablement": "!jupyter.webExtension"
},
{
"command": "jupyter.notebookeditor.collapseallcells",
"title": "%jupyter.command.jupyter.notebookeditor.collapseallcells.title%",
"category": "Notebook",
"enablement": "!jupyter.webExtension"
},
{
"command": "jupyter.expandallcells",
"title": "%jupyter.command.jupyter.expandallcells.title%",
Expand Down Expand Up @@ -1293,18 +1281,6 @@
"category": "Notebook",
"when": "jupyter.isnativeactive && isWorkspaceTrusted"
},
{
"command": "jupyter.notebookeditor.expandallcells",
"title": "%jupyter.command.jupyter.expandallcells.title%",
"category": "Notebook",
"when": "notebookEditorFocused && notebookType == 'jupyter-notebook'"
},
{
"command": "jupyter.notebookeditor.collapseallcells",
"title": "%jupyter.command.jupyter.collapseallcells.title%",
"category": "Notebook",
"when": "notebookEditorFocused && notebookType == 'jupyter-notebook'"
},
{
"command": "jupyter.expandallcells",
"title": "%jupyter.command.jupyter.expandallcells.title%",
Expand Down
8 changes: 0 additions & 8 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@
"jupyter.command.jupyter.runFileInteractive.title": "Run Current File in Interactive Window",
"jupyter.command.jupyter.debugFileInteractive.title": "Debug Current File in Interactive Window",
"jupyter.command.jupyter.runallcells.title": "Run All Cells",
"jupyter.command.jupyter.notebookeditor.expandallcells.title": {
"message": "Expand All Notebook Cells",
"comment": ["{Locked='Notebook'}"]
},
"jupyter.command.jupyter.notebookeditor.collapseallcells.title": {
"message": "Collapse All Notebook Cells",
"comment": ["{Locked='Notebook'}"]
},
"jupyter.command.jupyter.runallcellsabove.title": "Run Above",
"jupyter.command.jupyter.runcellandallbelow.title": "Run Below",
"jupyter.command.jupyter.runallcellsabove.palette.title": "Run Cells Above Current Cell",
Expand Down
2 changes: 0 additions & 2 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ export interface ICommandNameArgumentTypeMapping {
[DSCommands.NativeNotebookExport]: [Uri | undefined | { notebookEditor: { notebookUri: Uri } }];
[DSCommands.LatestExtension]: [string];
[DSCommands.EnableLoadingWidgetsFrom3rdPartySource]: [];
[DSCommands.NotebookEditorExpandAllCells]: [];
[DSCommands.NotebookEditorCollapseAllCells]: [];
[DSCommands.ShowDataViewer]: [IJupyterVariable | IShowDataViewerFromVariablePanel];
[DSCommands.RefreshDataViewer]: [];
[DSCommands.ClearSavedJupyterUris]: [];
Expand Down
34 changes: 0 additions & 34 deletions src/notebooks/notebookCommandListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ export class NotebookCommandListener implements IDataScienceCommandListener {
this.disposableRegistry.push(
commands.registerCommand(Commands.NotebookEditorAddCellBelow, () => this.addCellBelow())
);
this.disposableRegistry.push(
commands.registerCommand(Commands.NotebookEditorCollapseAllCells, () => this.collapseAll())
);
this.disposableRegistry.push(
commands.registerCommand(Commands.NotebookEditorExpandAllCells, () => this.expandAll())
);
this.disposableRegistry.push(
// TODO: if contributed anywhere, add context support
commands.registerCommand(Commands.RestartKernelAndRunUpToSelectedCell, () =>
Expand Down Expand Up @@ -128,34 +122,6 @@ export class NotebookCommandListener implements IDataScienceCommandListener {
edit.set(document.uri, [nbEdit]);
}).then(noop, noop);
}
private collapseAll() {
const document = window.activeNotebookEditor?.notebook;
if (!document) {
return;
}

chainWithPendingUpdates(document, (edit) => {
document.getCells().forEach((cell, index) => {
const metadata = { ...(cell.metadata || {}), inputCollapsed: true, outputCollapsed: true };
edit.set(document.uri, [NotebookEdit.updateCellMetadata(index, metadata)]);
});
}).then(noop, noop);
}

private expandAll() {
const document = window.activeNotebookEditor?.notebook;
if (!document) {
return;
}

chainWithPendingUpdates(document, (edit) => {
document.getCells().forEach((cell, index) => {
const metadata = { ...(cell.metadata || {}), inputCollapsed: false, outputCollapsed: true };
edit.set(document.uri, [NotebookEdit.updateCellMetadata(index, metadata)]);
});
}).then(noop, noop);
}

private async interruptKernel(notebookUri: Uri | undefined): Promise<void> {
const uri = notebookUri ?? this.notebookEditorProvider.activeNotebookEditor?.notebook.uri;
const document = workspace.notebookDocuments.find((document) => document.uri.toString() === uri?.toString());
Expand Down
2 changes: 0 additions & 2 deletions src/platform/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,6 @@ export namespace Commands {
export const NativeNotebookExport = 'jupyter.notebookeditor.export';
export const LatestExtension = 'jupyter.latestExtension';
export const EnableLoadingWidgetsFrom3rdPartySource = 'jupyter.enableLoadingWidgetScriptsFromThirdPartySource';
export const NotebookEditorExpandAllCells = 'jupyter.notebookeditor.expandallcells';
export const NotebookEditorCollapseAllCells = 'jupyter.notebookeditor.collapseallcells';
export const EnableDebugLogging = 'jupyter.enableDebugLogging';
export const ResetLoggingLevel = 'jupyter.resetLoggingLevel';
export const ShowDataViewer = 'jupyter.showDataViewer';
Expand Down
Loading