atom / xray
- вторник, 16 января 2018 г. в 03:15:39
An experimental next-generation Electron-based text editor
This is an experiment (that may go nowhere) in a new design for an Electron-based text editor which intends to explore the following ideas:
The core of the application is written in Rust. The core is a pure Rust library that lives in xray_core
. The core is then exposed to JavaScript as a native add-on for Node.js in xray_core_node
.
The buffer representation builds on what we learned with the Teletype CRDT, representing the document as a sequence of fragments in a persistent copy-on-write B+ tree. This should have a number of benefits.
Atom embraces web technology. Xray aims to subjugate it. While we still plan to give package authors maximal freedom to exploit all features of the web-based environment, the DOM will be treated more as an implementation detail rather than as a foundational abstraction. We aim to minimize leakage of any DOM-related concepts into our public APIs, with the possible exception of CSS for theming.
We want to avoid the DOM for rendering the text editor, for example, instead using a canvas, WebGL, or any other approach that can give us extremely good performance. This may make syntax themes slightly more difficult to build, and we accept that trade-off.
Focus on minimizing startup time from the beginning and don't add anything that degrades it.
Version APIs wherever possible to allow evolution without breakage. Use static typing wherever possible to clarify interfaces, improve documentation, and minimize the chances of inadvertent breakage. In core, expose the minimal API needed to get the job done, pushing other concerns out to libraries.
This is mostly for our own use right now and might not make a ton of sense just yet to the casual observer.
BroadcastLatest
, a single-producer/multi-consumer broadcast channel that implements the futures::Stream
trait and returns the most recently assigned value when polled. This will be used to propagate buffer and editor changes to observers.At this point we should have a very minimal working text editor that's obviously missing a ton of important features. There's a very long tail of features that will be required to make an even minimally usable system. If we decide to continue the experiment, here's a list of some major features we'll need to implement in rough priority order. Each of these bullets obviously implies a big task list of its own.
ripgrep
from the get-go. We can add a slower fallback implementation based on pcre
later for more complex regular expressions.