in src/main/main.ts [213:283]
function activateExtension(
app: JupyterLab,
palette: ICommandPalette,
notebooks: INotebookTracker,
documentManager: IDocumentManager,
settingRegistry: ISettingRegistry
) {
console.log("Activating code gathering tools...");
const notificationExtension = new NotificationExtension();
app.docRegistry.addWidgetExtension("Notebook", notificationExtension);
Clipboard.getInstance().copied.connect(() => {
notificationExtension.showMessage(
"Copied cells to clipboard. Type 'V' to paste."
);
});
let gatherModelRegistry = new GatherModelRegistry();
let codeGatheringExtension = new CodeGatheringExtension(
app,
documentManager,
settingRegistry,
notebooks,
gatherModelRegistry
);
app.docRegistry.addWidgetExtension("Notebook", codeGatheringExtension);
function addCommand(
command: string,
label: string,
execute: (options?: JSONObject) => void
) {
app.commands.addCommand(command, { label, execute });
palette.addItem({ command, category: "Clean Up" });
}
addCommand(
"gather:gatherToClipboard",
"Gather this result to the clipboard",
() => {
codeGatheringExtension.gatherToClipboard();
}
);
addCommand(
"gather:gatherToNotebook",
"Gather this result into a new notebook",
() => {
codeGatheringExtension.gatherToNotebook();
}
);
addCommand(
"gather:gatherToScript",
"Gather this result into a new script",
() => {
codeGatheringExtension.gatherToScript();
}
);
addCommand(
"gather:gatherFromHistory",
"Compare previous versions of this result",
() => {
codeGatheringExtension.gatherRevisions();
}
);
initLogger(settingRegistry);
console.log("Gathering tools have been activated.");
}