How to use the @jupyterlab/codemirror.CodeMirrorEditorFactory function in @jupyterlab/codemirror

To help you get started, we’ve selected a few @jupyterlab/codemirror examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / tests / test-codeeditor / src / jsoneditor.spec.ts View on Github external
describe('JSONEditor', () => {
    let editor: LogEditor;
    let editorServices = new CodeMirrorEditorFactory();
    const editorFactory = editorServices.newInlineEditor.bind(editorServices);

    beforeEach(() => {
      editor = new LogEditor({ editorFactory });
    });

    afterEach(() => {
      editor.dispose();
    });

    describe('#constructor', () => {
      it('should create a new metadata editor', () => {
        let newEditor = new JSONEditor({ editorFactory });
        expect(newEditor).to.be.an.instanceof(JSONEditor);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-notebook / src / notebooktools.spec.ts View on Github external
describe('NotebookTools.NotebookMetadataEditorTool', () => {
      const editorServices = new CodeMirrorEditorFactory();
      const editorFactory = editorServices.newInlineEditor.bind(editorServices);

      it('should create a new metadata editor tool', () => {
        const tool = new NotebookTools.NotebookMetadataEditorTool({
          editorFactory
        });
        expect(tool).to.be.an.instanceof(
          NotebookTools.NotebookMetadataEditorTool
        );
      });

      it('should handle a change to the active notebook', () => {
        panel0.model.metadata.set('panel0', 1);
        panel1.model.metadata.set('panel1', 1);
        const tool = new NotebookTools.NotebookMetadataEditorTool({
          editorFactory
github jupyterlab / jupyterlab-data-explorer / tests / test-codemirror / src / factory.spec.ts View on Github external
it('should create a new editor with given options', () => {
      const factory = new CodeMirrorEditorFactory(options);
      const editor = factory.newDocumentEditor({
        host,
        model
      }) as CodeMirrorEditor;
      expect(editor).to.be.an.instanceof(CodeMirrorEditor);
      for (let key in Object.keys(options)) {
        const option = key as keyof CodeMirrorEditor.IConfig;
        expect(editor.getOption(option)).to.equal(options[option]);
      }
      editor.dispose();
    });
  });
github jupyterlab / jupyterlab-data-explorer / tests / test-codemirror / src / factory.spec.ts View on Github external
it('should create a new editor', () => {
      const factory = new CodeMirrorEditorFactory();
      const editor = factory.newInlineEditor({ host, model });
      expect(editor).to.be.an.instanceof(CodeMirrorEditor);
      editor.dispose();
    });
github jupyterlab / debugger / tests / src / debugger.spec.ts View on Github external
describe('Debugger', () => {
  const service = new DebuggerService();
  const registry = new CommandRegistry();
  const factoryService = new CodeMirrorEditorFactory();
  const mimeTypeService = new CodeMirrorMimeTypeService();

  let sidebar: TestSidebar;

  beforeEach(() => {
    sidebar = new TestSidebar({
      service,
      callstackCommands: {
        registry,
        continue: '',
        terminate: '',
        next: '',
        stepIn: '',
        stepOut: ''
      },
      editorServices: {
github jupyterlab / jupyterlab / tests / test-fileeditor / src / widget.spec.ts View on Github external
describe('fileeditorcodewrapper', () => {
  const factoryService = new CodeMirrorEditorFactory();
  const modelFactory = new TextModelFactory();
  const mimeTypeService = new CodeMirrorMimeTypeService();
  let context: Context;
  let manager: ServiceManager.IManager;

  beforeAll(() => {
    manager = new ServiceManager({ standby: 'never' });
    return manager.ready;
  });

  describe('FileEditorCodeWrapper', () => {
    let widget: FileEditorCodeWrapper;

    beforeEach(() => {
      const path = UUID.uuid4() + '.py';
      context = new Context({ manager, factory: modelFactory, path });
github jupyterlab / jupyterlab-data-explorer / tests / test-fileeditor / src / widget.spec.ts View on Github external
describe('fileeditorcodewrapper', () => {
  const factoryService = new CodeMirrorEditorFactory();
  const modelFactory = new TextModelFactory();
  const mimeTypeService = new CodeMirrorMimeTypeService();
  let context: Context;
  let manager: ServiceManager.IManager;

  beforeAll(() => {
    manager = new ServiceManager({ standby: 'never' });
    return manager.ready;
  });

  describe('FileEditorCodeWrapper', () => {
    let widget: FileEditorCodeWrapper;

    beforeEach(() => {
      const path = UUID.uuid4() + '.py';
      context = new Context({ manager, factory: modelFactory, path });
github jupyterlab / jupyterlab / examples / filebrowser / src / index.ts View on Github external
activeWidget = widget;
      widget.disposed.connect((w: Widget) => {
        let index = widgets.indexOf(w);
        widgets.splice(index, 1);
      });
    }
  };

  let docRegistry = new DocumentRegistry();
  let docManager = new DocumentManager({
    registry: docRegistry,
    manager,
    opener
  });
  let editorServices = {
    factoryService: new CodeMirrorEditorFactory(),
    mimeTypeService: new CodeMirrorMimeTypeService()
  };
  let wFactory = new FileEditorFactory({
    editorServices,
    factoryOptions: {
      name: 'Editor',
      modelName: 'text',
      fileTypes: ['*'],
      defaultFor: ['*'],
      preferKernel: false,
      canStartKernel: true
    }
  });
  docRegistry.addWidgetFactory(wFactory);

  let commands = new CommandRegistry();
github jupyterlab / jupyterlab / packages / cells / src / inputarea.ts View on Github external
function _createDefaultEditorFactory(): CodeEditor.Factory {
    let editorServices = new CodeMirrorEditorFactory();
    return editorServices.newInlineEditor;
  }