Skip to content

Introduce DocumentUri concept.#170

Merged
dbaeumer merged 1 commit intomicrosoft:masterfrom
bolinfest:introduce-document-uri
Feb 6, 2017
Merged

Introduce DocumentUri concept.#170
dbaeumer merged 1 commit intomicrosoft:masterfrom
bolinfest:introduce-document-uri

Conversation

@bolinfest
Copy link
Contributor

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.

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.
@msftclas
Copy link

Hi @bolinfest, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. Real humans will now evaluate your PR.

TTYL, MSBOT;

@dbaeumer
Copy link
Member

dbaeumer commented Feb 6, 2017

@bolinfest Thanks for making this easier to understand.

@dbaeumer dbaeumer merged commit d72d515 into microsoft:master Feb 6, 2017
@bolinfest bolinfest deleted the introduce-document-uri branch February 6, 2017 20:21
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.

3 participants