Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

WIP: Monaco editor as IEditorServices #23

Closed
wants to merge 26 commits into from

Conversation

fcollonval
Copy link
Member

@fcollonval fcollonval commented Nov 15, 2018

This is the prolongation of #22 pushing for higher integration of monaco in Jupyterlab by replacing CodeMirror editor services.

This is highly experimental and raises questions.

LSP integration

  • LSP is based on a rootUri folder. In code editor (like vscode), the package folder is easily identified as such. But in the case of JupyterLab, the root folder of the server may be too broad compare to the folder of interest for the user. In particular in online configuration through JupyterHub, the root folder will be the user home folder that probably will contain multiple study sub folders. So should the user specified a specific folder as rootUri.
  • LSP tags content through file uri (see Location and TextDocumentIdentifier in the specification). But from what I saw, CodeEditor.IModel relies only on mimetypes. I think this is the reason why the current code is raising warning when multiple files are opened - as they are not related to uri. It is kind of lost; lacking context information from text sources. I presumed this could be improved by overwriting the FileEditor to have the LSP connection driven by the file opening/closing action rather than the onMimeTypeChanged event (
    manager.startLanguageClient(id, this.editor);
    ) - but mimetype should still be handled. So presumably a better approach would be to add an optional path attribute in CodeEditor.IModel.
  • Kernel trouble - from my vscode experience, linter package should be installed in every Python environment. So the current approach using one websocket per language is probably too simple for handling multiple kernels of the same language.

CodeMirror suppression

The current implementation is far from complete. Main functions missing:

  • Event connections
  • Command execution
  • Undo/Redo connection
  • Collaboration (marking text, updating value from realtime edition)
  • Editor options
  • What happen with the completer if there is a LSP server it becomes useless.

Something odd

The content text is not available directly in the constructor. I had to introduce a timeout before loading it in the editor.
corrected by 34fedb1

@meeseeksmachine
Copy link

This pull request has been mentioned on Jupyter Community Forum. There might be relevant details there:

https://discourse.jupyter.org/t/create-extension-to-provide-custom-cell-editor/2819/2

@fcollonval fcollonval closed this Aug 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants