Skip to content

Latest commit

 

History

History
25 lines (13 loc) · 4.43 KB

2018_05_07.md

File metadata and controls

25 lines (13 loc) · 4.43 KB

Update for May 7, 2018

Contributions

@yajamon contributed a fix for an oversight in our build script where we were specifying +nightly even though our repository is associated with a rust-toolchain file. Thanks!

First internal demo is complete

As I mentioned in the last update, we focused last week on preparing for an internal demo that presented at least a tiny slice of the Xray vision in a more tangible, interactive form. We spun up a headless Xray server as a digital ocean droplet and showed off remote shared workspaces, collaborative editing, and conversations tied to the code. We also put together a few slides demonstrating Xray's performance for various tasks such as fuzzy file-finding, moving large numbers of cursors, and scrolling. The response was really positive, and we've elected to continue the experiment into the next quarter. @as-cii and I will continue to focus on Xray in the coming months, and we'll get a bit of support from @maxbrunsfeld in order to integrate tree-sitter as the basis of Xray's syntax awareness.

Into the unknown with CRDTs

As I discussed in the first update, Using CRDTs in Xray's native buffer implementation allows us to create anchors, which are stable references to positions within a text file that maintain their logical position even after the buffer is subsequently edited. For our discussions feature, we use anchors to link each message to the range of the buffer that was selected at the time the message was sent. This allows you to select a code fragment and make a comment, then allow other participants to click on the message at some later time to jump to the code you had selected when you sent the message. For now, Xray only maintains all of this state in memory. The discussion history is lost as soon as you kill the process, and we deliberately avoid dropping buffers once they are open in order to preserve the validity of anchors. This is obviously not going to work, and to fix it, we need to figure out how to persist each buffer's operation history.

If we assume that buffers are never renamed and that history only ever marches forward, this is pretty easy. But the possibility of renames and interactions with Git (or other version control systems) make it interesting. We want to track a file's identity across renames and ensure that we load the appropriate history when the user switches branches, and these concerns have a lot of overlap with some other ideas we've been pondering that can loosely be described as "real-time version control". With a proof-of-concept for shared workspaces behind us, we think it's time to explore them.

Currently, we represent buffers as CRDTs. We're interested in what happens if we take that further and treat the entire repository as a single unified CRDT data structure that is persisted to disk. Ideally, assuming Xray is used for every edit, we will be able to maintain a keystroke-level history of every edit to every file all the way back to the moment that each file was created, sort of like an infinite conflict-free undo history. But of course, there will be many cases where files change occur outside of Xray, so we'll need to gracefully handle those situations as well. We've decided to spend the next couple weeks exploring this. We'll probably spend most of our time clarifying our thoughts in writing at first before transitioning to coding. It's unclear exactly how much gold is at the end of this particular rainbow, but it seems worth a look.

Strike out with futures 0.2

On Friday, we spent an hour and a half upgrading xray_core to futures 0.2, only to discover that Tokio doesn't yet support that version 🙈. Luckily, it wasn't that much time wasted, but we did feel somewhat foolish for assuming that Tokio worked with it without checking first.

Optimizations

@as-cii has been picking some low-hanging optimization fruit related to selections and editing. The first is related to adding selections above and below the cursor. He's also been looking at batching tree manipulation when editing with multiple cursors, which is still in progress and is not yet associated with a PR.