Switch notebook editors to monaco (#239)

* Upgrade nteract packages and related dependencies to make new stateful-component work

* Switch to new monacoEditor

* Configure store using nteract mythic configuration

* Replace CodeMirror with Monaco editor in NotebookReadOnlyRenderer

* Reformat

* Upgrade d3 to latest to resolve d3-selection conflicts with nteract/data-explorer that broke D3ForceGraph

* Upgrade jupyterlab terminal widget to work with latest version of react. Upgrade jupyterlab services to include latest fix for websocket auth

* Update jest test snapshots

* Upgrade packages to fix build issues

* Remove comment

* Fix unit tests

* Fix unit test snapshot

* Remove useless @types/node-fetch
This commit is contained in:
Laurent Nguyen
2020-10-01 14:00:46 +02:00
committed by GitHub
parent 4fe2098730
commit 0ad5fb465b
21 changed files with 5135 additions and 11636 deletions

View File

@@ -13,6 +13,7 @@ import {
makeAppRecord,
makeCommsRecord,
makeContentsRecord,
makeEditorsRecord,
makeEntitiesRecord,
makeHostsRecord,
makeJupyterHostRecord,
@@ -34,6 +35,7 @@ import configureStore from "./NotebookComponent/store";
import { Notification } from "react-notification-system";
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
import { configOption, createConfigCollection, defineConfigOption } from "@nteract/mythic-configuration";
export type KernelSpecsDisplay = { name: string; displayName: string };
@@ -112,20 +114,15 @@ export class NotebookClientV2 {
host: jupyterHostRecord
// TODO: tamitta: notificationSystem.addNotification was removed, do we need a substitute?
}),
comms: makeCommsRecord(),
config: Immutable.Map({
theme: "light",
editorType: params.cellEditorType || "codemirror",
autoSaveInterval: params.autoSaveInterval || Constants.Notebook.autoSaveIntervalMs
}),
core: makeStateRecord({
currentKernelspecsRef: kernelspecsRef,
entities: makeEntitiesRecord({
editors: makeEditorsRecord({}),
hosts: makeHostsRecord({
byRef: Immutable.Map<string, HostRecord>().set(this.contentHostRef, jupyterHostRecord)
}),
comms: makeCommsRecord(),
contents: makeContentsRecord({
// byRef: Immutable.Map<string, ContentRecord>().set(this.contentRef, record)
byRef: Immutable.Map<string, ContentRecord>()
}),
transforms: makeTransformsRecord({
@@ -238,6 +235,24 @@ export class NotebookClientV2 {
};
this.store = configureStore(initialState, params.contentProvider, traceErrorFct, [cacheKernelSpecsMiddleware]);
// Additional configuration
this.store.dispatch(configOption("editorType").action(params.cellEditorType ?? "monaco"));
this.store.dispatch(
configOption("autoSaveInterval").action(params.autoSaveInterval ?? Constants.Notebook.autoSaveIntervalMs)
);
createConfigCollection({
key: "monaco"
});
defineConfigOption({
label: "Show Line numbers",
key: "monaco.lineNumbers",
values: [
{ label: "Yes", value: true },
{ label: "No", value: false }
],
defaultValue: true
});
}
/**