Code Monkey home page Code Monkey logo

jupyterlab-monaco's Introduction

This project has been archived by lack of maintainers

JupyterLab Monaco Editor Extension

A JupyterLab extension providing the Monaco editor.

The current state of this extension is merely a 'proof-of-concept' implementation and nowhere near production status. All functionality and interaction with the 'abstract editor interface' that JupyterLab provides is still missing.

Also, the Codemirror themes, Codemirror syntax highlighting and Codemirror keymaps won't work with Monaco. That would have to be managed separately.

As for the VS Code extensions: Monaco is the editor that powers VS Code. Or to put it otherwise: Monaco is merely a part of the whole VS Code application, packaged to work on the web (limited capabilities compared to desktop). An extension for VS Code therefore is not guaranteed to work on Monaco, as it probably uses a whole lot more of VS Code than merely the Monaco parts. The other way around is much more probable.

Feel free to head over to Monaco's repo and website to see what is and isn't possible. Their FAQ explains a lot.

intellisense minimap

Prerequisites

  • JupyterLab 0.32

Development

For a development install, do the following in the repository directory:

yarn install
yarn run build
jupyter labextension link .

To rebuild the package and the JupyterLab app:

yarn run build
jupyter lab build

If you have an node error like FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory, you can increase the memory available to node by creating an environment variable:

export NODE_OPTIONS=--max-old-space-size=4096

Development notes

The tricky thing about this repo is that we webpack up Monaco as part of the build process and publish those JavaScript files as part of the package. Because Monaco likes to use web workers to start up parts of the application, we must have standalone js files and a way to get the URL for those files in the final JupyterLab build. We get the URL in the extension by using the webpack file loader (triggered by prefixing an import with file-loader!) in the final JupyterLab build for the Monaco js files. Since we depend on the webpack file-loader npm package, we know that the JupyterLab build will have that loader available.

jupyterlab-monaco's People

Contributors

blink1073 avatar fcollonval avatar gnestor avatar ian-r-rose avatar jasongrout avatar saulshanabrook avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jupyterlab-monaco's Issues

Did this get abandoned?

Looks like commits are a year or more old.
I find this repor to be a super great idea, so its sad if it has stopped.
Maybe somebody else carried on the great work?

How to install on jupyterlab version > 1.0.0 ?

When I try to install on jupyterlab=1.0.0, it reports error below. Maybe you can update the extension for jupyterlab>=1.0.0?

ValueError:
"[email protected]" is not compatible with the current JupyterLab
Conflicting Dependencies:
JupyterLab              Extension      Package
>=1.2.1 <1.3.0          >=0.18.0 <0.19.0@jupyterlab/application
>=1.2.1 <1.3.0          >=0.18.0 <0.19.0@jupyterlab/apputils
>=3.2.0 <3.3.0          >=2.0.2 <3.0.0 @jupyterlab/coreutils
>=1.2.1 <1.3.0          >=0.18.0 <0.19.0@jupyterlab/fileeditor

Installation in jupyterlab dev mode

I made some modification on original jupyterlab application, so I need to run the dev mode.
I got such error after running jlpm run add:sibling ./extensions/jupyterlab-monaco(I placed the jupyterlab-monaco repo under extensions folder under jupyterlab code root directory):

$ jlpm run add:sibling ./extensions/jupyterlab-monaco
yarn run v1.3.2
$ node buildutils/lib/add-sibling.js ./extensions/jupyterlab-monaco
> jlpm run integrity
$ node buildutils/lib/ensure-repo.js
npm ERR! code E404
npm ERR! 404 Not found : file-loader!..
npm ERR! 404 
npm ERR! 404  'file-loader!..' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because 
npm ERR! 404  1. name can no longer contain special characters ("~'!()*")
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/zhaofengli/.npm/_logs/2018-06-20T06_52_57_173Z-debug.log
child_process.js:644
    throw err;
    ^

Error: Command failed: npm view file-loader!.. version
npm ERR! code E404
npm ERR! 404 Not found : file-loader!..
npm ERR! 404 
npm ERR! 404  'file-loader!..' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because 
npm ERR! 404  1. name can no longer contain special characters ("~'!()*")
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/zhaofengli/.npm/_logs/2018-06-20T06_52_57_173Z-debug.log

    at checkExecSyncError (child_process.js:601:13)
    at Object.execSync (child_process.js:641:13)
    at Object.getDependency (/Users/zhaofengli/projects/goldersgreen/frontend/src/packages/jupyterlab_package/buildutils/lib/get-dependency.js:69:45)
    at /Users/zhaofengli/projects/goldersgreen/frontend/src/packages/jupyterlab_package/buildutils/lib/ensure-package.js:83:51
    at Array.forEach (<anonymous>)
    at Object.ensurePackage (/Users/zhaofengli/projects/goldersgreen/frontend/src/packages/jupyterlab_package/buildutils/lib/ensure-package.js:74:11)
    at ensureIntegrity (/Users/zhaofengli/projects/goldersgreen/frontend/src/packages/jupyterlab_package/buildutils/lib/ensure-repo.js:194:46)
    at Object.<anonymous> (/Users/zhaofengli/projects/goldersgreen/frontend/src/packages/jupyterlab_package/buildutils/lib/ensure-repo.js:240:5)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Comprehensive install script

As I'm experiencing troubles setting up the right dev environment on WSL, I thought it useful to solve it in an issue here. I'm on WSL x64 (Ubuntu 16.04) using Miniconda3.

I went through the jupyterlab contributing guide and the instructions on this repo and did the following in a folder /mnt/d/jlab/:

conda create -n monaco
source activate monaco
conda install -c conda-forge nodejs notebook nb_conda_kernels
git clone https://github.com/<your-github-username>/jupyterlab.git
cd jupyterlab
pip install -e .
jlpm install
jlpm run build  # Build the dev mode assets (optional)
jlpm run build:core  # Build the core mode assets (optional)
jupyter lab build  # Build the app dir assets (optional)
cd ..
git clone https://github.com/jupyterlab/jupyterlab-monaco.git
cd jupyterlab-monaco
yarn install
yarn run build
jupyter labextension link .

That final command sometimes ends up in an infinite loop, supplying dev mode argument helps it to pass.
I tried experimenting with rebuilding after I made the changes in that config.json you mentioned somewhere, but I can't get it to work.

I can start JupyterLab with the default command, but the text editor is still codemirror.

Would you mind helping out with a comprehensive bash file that should work in principle? Did I forget anything or got something wrong?

I guess it's just "first-timer" issues.

Screenshots for a demo?

It's hard to know how mature a project is without installing it, if no screenshots are included.

Editor theme and key map not applied to Monaco?

Really excited about this extension!

It seems the text editor settings for key mapping and editor theme don't apply to Monaco, is that correct? Is it possible to add vim or other key mappings to monaco or will that only be possible through the use of extensions?

And is their hope that extensions from VS code could be migrated to monaco on jupyter lab, or will they have to be written from scratch?

Thanks!

Editor fails to start at the second time

There is a weird behavior observed in my setup: After a file is open and then closed with Monaco, when it is open the second time, the following error message pops up in the Firefox JS console:

TypeError: this.editor is undefined [Learn More] index.js:72

which is corresponded to the following line:

this.editor.setValue(contextModel.toString());

This error prevents the editor to show up in the Jupyterlab window. It seems that the old MonacoWidget object is not destroyed when the editor tab is closed. Refreshing the webpage solved this problem.

My environment:

  • jupyterlab-monaco commit f710e41
  • Firefox 59.0.2
  • Jupyterlab 0.32.1

Building Error: error TS2420: Class 'RenderedCommon' incorrectly implements interface 'IRenderer'.

I met the following error when run
yarn run build

node_modules/@jupyterlab/rendermime/lib/widgets.d.ts(7,31): error TS2420: Class 'RenderedCommon' incorrectly implements interface 'IRenderer'.
Types of property 'title' are incompatible.
Type 'Title' is not assignable to type 'Title'. Two different types with this name exist, but they are unrelated.
Types of property 'owner' are incompatible.
Type 'Widget' is not assignable to type 'Widget'. Two different types with this name exist, but they are unrelated.
Types of property 'layout' are incompatible.
Type 'Layout' is not assignable to type 'Layout'. Two different types with this name exist, but they are unrelated.
Property 'init' is protected but type 'Layout' is not a class derived from 'Layout'.
error Command failed with exit code 1.

Highlighting?

Is there a way to install custom language highlighting-support? As I understand it, highlighting ist not handled by LSP yet, so it has to installed independently.

"[email protected]" is not compatible with the current JupyterLab

Thank you for the great work. ๐ŸŽ‰

However, during the building process, a conflict occurred:

jupyterlab-monaco-0.1.0.tgz

Errored, use --debug for full output:
ValueError: 
"[email protected]" is not compatible with the current JupyterLab
Conflicting Dependencies:
JupyterLab              Extension            Package
>=0.15.4-0 <0.16.0-0    >=0.16.2-0 <0.17.0-0 @jupyterlab/application
>=0.15.4-0 <0.16.0-0    >=0.16.2-0 <0.17.0-0 @jupyterlab/fileeditor
>=0.15.5-0 <0.16.0-0    >=0.16.3-0 <0.17.0-0 @jupyterlab/apputils

Seems the dependencies are too new. So I modified the corresponding versions in the package.json,
this problem was gone.

Hope this extension could be published on npm soon, thus saving the building process. ๐Ÿ˜„

Upgrade jupyterlab depedencies to work with jupyterlab 0.33.0

"[email protected]" is not compatible with the current JupyterLab
Conflicting Dependencies:
JupyterLab              Extension        Package
>=0.17.2 <0.18.0        >=0.16.2 <0.17.0 @jupyterlab/application
>=0.17.2 <0.18.0        >=0.16.3 <0.17.0 @jupyterlab/apputils
>=2.0.2 <3.0.0          >=1.1.2 <2.0.0   @jupyterlab/coreutils
>=0.17.2 <0.18.0        >=0.16.2 <0.17.0 @jupyterlab/fileeditor

Archiving this repository

This repository is part of the repositories listed as inactive during the JupyterLab team call.

This issue is to ping anyone listening for changes in this repository that starting from today if no volunteer propose him/herself to maintain this repository it will be archived in 2 weeks (aka July 27th, 2023).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.