Adding support for Visual Studio Live Share #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thefile:
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:
Use
Uri.toString()
as opposed toUri.fsPath
orTextDocument.fileName
, since the later two APIs strip theUri
's scheme, which removes thevsls:
portion that is critical for Live Share.Use
Uri.parse()
as opposed toUri.file()
, since the later always appends thefile://
scheme to the parseUri
, as opposed to parsing the provided string, and respecting its scheme (if there is one)Using the overload of
workspace.openTextDocument
that provides aUri
instance instead of a string, since when providing a string, it internally callsUri.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