atom-archive / xray

An experimental next-generation Electron-based text editor
MIT License
8.48k stars 235 forks source link

Introduce Location API #174

Closed as-cii closed 5 years ago

as-cii commented 5 years ago

This pull request introduces a first iteration of the location API. Specifically, WorkTree will now support the following methods:

Future steps

In the future I believe we should enhance this API to also supply a SelectionSetId. This is because any given buffer could have an arbitrary number of selections (e.g., when multiple editors are backed by the same buffer), and we want to provide a way of determining which one is the one currently used by each replica.

A digression about paths

At some point I think we should do something about all these path-based APIs, as they prevent Memo from being used in contexts where untitled buffers can be created. Path-based APIs are nice in that they don't get invalidated when switching epochs, contrarily to FileIds which are tied only to a given epoch. I can think of different ways of solving this: