Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for Visual Studio Live Share #2

Merged
merged 1 commit into from
Mar 11, 2018
Merged

Adding support for Visual Studio Live Share #2

merged 1 commit into from
Mar 11, 2018

Conversation

lostintangent
Copy link
Contributor

@lostintangent lostintangent commented Mar 10, 2018

This PR adds support for Visual Studio Live Share, by ensuring that all serialization and parsing of document URIs are done using the VS Code APIs which preserve the correct scheme. This is important because "guests" within a Live Share session see remote files using the vsls: scheme, whereas the the host, as well as non-Live Share users, would see files using the file: scheme. Therefore, this change preserves the existing behavior, while allowing Checkpoint users to continue using it within the context of a collaboration session 🚀

What's cool about this, is that users can create independent checkpoints, which track not only there own changes, but also those coming from other participants in a Live Share session (which enables real-time co-editing). This enhances the pair programming experience, and allow devs to create checkpoints, without needing to rely on Git commits to do it.

In detail, this PR makes three key refactorings:

  1. Use Uri.toString() as opposed to Uri.fsPath or TextDocument.fileName, since the later two APIs strip the Uri's scheme, which removes the vsls: portion that is critical for Live Share.

  2. Use Uri.parse() as opposed to Uri.file(), since the later always appends the file:// scheme to the parse Uri, as opposed to parsing the provided string, and respecting its scheme (if there is one)

  3. Using the overload of workspace.openTextDocument that provides a Uri instance instead of a string, since when providing a string, it internally calls Uri.file() to parse it, which then runs into problem Adding support for Visual Studio Live Share #2.

Long-term, there may be some additional capabilities that would be cool to explore, as Live Share adds some extensibility points (e.g. allowing opting-in to syncing checkpoints, auto-creating checkpoints when editing a file within a Live Share session, etc.). This is an awesome extension, and so I'm keen to see it support Live Share collaboration 👍

// CC @micnil

@micnil
Copy link
Owner

micnil commented Mar 11, 2018

Thanks fo your pull request! Visual Studio Live Share seems awesome! I can see how it would be very powerful for pair programming and reviewing code. Might be cool to combine with a in-IDE chat like codestream.

Your refactorings seem to preserve the current functionality nicely. However, in the upgrade scenario all existing checkpoints will not be able to open anymore. Not a big problem seeing Checkpoints only has 39 installs so far, but since this will be a recurring problem everytime (breaking) changes are made to the store state, I should work on a upgrade strategy before publishing.

I'm thinking that i'll introduce a version field to the CheckpointStore, and when loading the store from workspaceState, we can handle changes to the store depending on the version number.

Thanks again,
Michael

@micnil micnil merged commit 12f3cf3 into micnil:master Mar 11, 2018
@lostintangent
Copy link
Contributor Author

lostintangent commented Mar 11, 2018

@micnil Thanks! I’d like to write a simple “recipe” for the Live Share docs that demonstrates using it with this extension. So I’ll keep an eye out for when you release an update to the marketplace.

Also, if you’re interested in Live Share, send me an email (joncart@microsoft.com) with the email address that you’d like to be invited, and I’d love to get your feedback on it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants