[Document Link Provider] Adding Visual Studio Live Share support #174
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 to the document link provider, by ensuring that URI construction is done using the VS Code APIs which preserve the correct scheme. This is necessary because "guests" within a Live Share session see remote files using the
vsls:
scheme, whereas the the host (and non-Live Share users) sees files using thefile:
scheme. Therefore, this change preserves the existing behavior, while allowing REST Client users to click on< foo.js
links within the context of a collaboration session 馃殌 Specifically, this PR makes the following two changes:Use
Uri.toString()
as opposed toUri.fsPath
, since the later strips 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)VS Live Share + REST Client integration is already really great, since the "host" can share a locally running REST API, and the "guest" can then author requests against it (see this video). This PR extends that experience by making sure the document links work for all participants in a collaboration session.
// CC @Huachao