Skip to content

Fix documentLink/resolve by introducing a data field#336

Merged
dbaeumer merged 1 commit into
microsoft:masterfrom
rcjsuen:link-data
Apr 26, 2018
Merged

Fix documentLink/resolve by introducing a data field#336
dbaeumer merged 1 commit into
microsoft:masterfrom
rcjsuen:link-data

Conversation

@rcjsuen

@rcjsuen rcjsuen commented Apr 12, 2018

Copy link
Copy Markdown
Contributor

The current definition of a DocumentLink makes resolving a link with documentLink/resolve essentially impossible. With only a range field available, it is not possible for the server to deduce what the originating content is as it does not have any information as to which text document the link is for.

To correct this, a new data field has been introduced to DocumentLink that servers can fill in with some whatever it needs when initially fulfilling the textDocument/documentLink request. This way, a subsequent documentLink/resolve request will have the necessary contextual information available to resolve the link and return back a URI to use in the target field.

The current definition of a DocumentLink makes resolving a link with
documentLink/resolve essentially impossible. Having only a range
field filled out is not enough information for a language server to
deduce what content or file the link is about. To correct this, a new
data field has been introduced to DocumentLink that servers can fill
in with some data on the initial fulfillment of a
textDocument/documentLink request so that subsequent
documentLink/resolve requests will have some contextual information
available to resolve the link.

Signed-off-by: Remy Suen <[email protected]>
@dbaeumer dbaeumer merged commit 4c66383 into microsoft:master Apr 26, 2018
@dbaeumer

Copy link
Copy Markdown
Member

@rcjsuen can you please update the spec. E.g. have

	/**
	 * A data entry field that is preserved on a document link between a
	 * DocumentLinkRequest and a DocumentLinkResolveRequest.
	 */
	data?: any

in there as well.

@rcjsuen

rcjsuen commented Apr 26, 2018

Copy link
Copy Markdown
Contributor Author

Thank you for merging in the PR, Dirk. I've opened microsoft/language-server-protocol#464 to add the data property to the spec.

@dbaeumer

Copy link
Copy Markdown
Member

@rcjsuen thanks

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.

2 participants