jupyter-lsp / jupyterlab-lsp

Coding assistance for JupyterLab (code navigation + hover suggestions + linters + autocompletion + rename) using Language Server Protocol
https://jupyterlab-lsp.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.78k stars 146 forks source link

Hoist CodeMirror Mark Widgets to a Layer-based model #500

Open bollwyvl opened 3 years ago

bollwyvl commented 3 years ago

Elevator Pitch

Hoist the various kinds of mark widgets (lines, token, gutter) to an evented model. Allow for separate owners by organizing sets of marks as layers.

Motivation

Our current design assumes that one agent (usually our diagnostic feature) controls all the marks on an editor instance. At the end of the day, the implementation would still need to do the same work to ensure that marks are up-to-date, but if we want to support multiple sources of information (#184) without going crazy, we're going to need a better way to organize them.

Design Ideas

With this, we could also offer UI (notionally as a sidebar) for hiding/reordering the mark layers.

Presumably, this could be hoisted to Lab core's CodeEditor... or better still a JEP-level definition of "what is a text editor", with a full JSON Schema model of all of these pieces, such that this could be integrated into a terminal-based editing experience (e.g. ipython) and would be better describable by assistive technologies.

bollwyvl commented 3 years ago

Looking forward, much of this is supported by the CodeMirror 6 DecorationSet.

Another happy thing I saw was the legacy-modes repo, which should provide not only many of the modes needed to get up to feature parity, but also the blueprint for porting other novel modes.

It'll be a haul, and CM6 is still in beta, and is not going to support LSP directly, but the architecture looks a lot more like something we can build on without having to get fancy. We'll lose direct control via CSS of basically everything, but I think given what we've learned on this project, the path to supporting mobile, screen readers, and LSP features are all pointing at CM6 as the right path forward.