Introduce DocumentUri concept.#170
Merged
dbaeumer merged 1 commit intomicrosoft:masterfrom Feb 6, 2017
Merged
Conversation
In the protocol, interface fields that are meant to specify the URI of a document are simply declared as `string`. This underspecifies the requirements of these fields because the contents of the string must be able to parse as a URI (at a minimum, using the `vscode-uri` npm module). This introduces a type alias, `DocumentUri`, that tightens these guarantees without changing the wire protocol. It updates what I believe are all of the relevant interfaces to specify `DocumentUri` instead of `string`, as appropriate. Note that this type is deliberately named `DocumentUri` rather than simply `Uri` to convey that it is a `URI` that identifies a `TextDocument` in the LSP object model (as opposed to an arbitrary URI). I am by no means tied to the name of the type alias: I just want this concept to be formalized in the specification so it is possible to create a proxy that can reliably rewrite all `DocumentUri` parameters such that a local editor can make requests to a remote language server even though different URIs may be used on both sides of the connection to refer to the same document.
|
Hi @bolinfest, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
Member
|
@bolinfest Thanks for making this easier to understand. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In the protocol, interface fields that are meant to specify the URI of a
document are simply declared as
string. This underspecifies the requirementsof these fields because the contents of the string must be able to parse as a
URI (at a minimum, using the
vscode-urinpm module).This introduces a type alias,
DocumentUri, that tightens these guaranteeswithout changing the wire protocol. It updates what I believe are all of the
relevant interfaces to specify
DocumentUriinstead ofstring, asappropriate.
Note that this type is deliberately named
DocumentUrirather than simplyUrito convey that it is aURIthat identifies aTextDocumentin theLSP object model (as opposed to an arbitrary URI).
I am by no means tied to the name of the type alias: I just want this concept to
be formalized in the specification so it is possible to create a proxy that
can reliably rewrite all
DocumentUriparameters such that a local editor canmake requests to a remote language server even though different URIs may be used
on both sides of the connection to refer to the same document.