Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language Server Protocol: Document Highlights #1802

Closed
vparfonov opened this issue Jul 18, 2016 · 4 comments
Closed

Language Server Protocol: Document Highlights #1802

vparfonov opened this issue Jul 18, 2016 · 4 comments
Assignees
Labels
kind/enhancement A feature request - must adhere to the feature request template.

Comments

@vparfonov
Copy link
Contributor

The document highlight request is sent from the client to the server to resolve a document highlights for a given text document position.
Changed:: in 2.0 the requests uses TextDocumentPositionParams with a proper textDocument and position property. In 1.0 the uri of the referenced text document was inlined into the params object.
https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#document-highlights

@vparfonov vparfonov added kind/enhancement A feature request - must adhere to the feature request template. team/ide labels Jul 18, 2016
@vparfonov
Copy link
Contributor Author

A document highlight is a range inside a text document which deserves special attention. Usually a document highlight is visualized by changing the background color of its range.

@xcoulon
Copy link
Contributor

xcoulon commented Nov 21, 2016

Looks like the link to the Document Highlights section (as it appears in the issue description) is broken. It could be replaced with: https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#document-highlights-request

@xcoulon
Copy link
Contributor

xcoulon commented Dec 9, 2016

It seems like the current io.typefox.lsapi.services jar contains erroneous methods. For example:

TextDocumentService {
  ...
  /**
    * The document highlight request is sent from the client to the server to to resolve a document highlights for a
    * given text document position.
    */
  def CompletableFuture<DocumentHighlight> documentHighlight(TextDocumentPositionParams position)
    ...
}

This method returns a single DocumentHighlight (ie, a single occurrence of a selected word to highlight in the editor), which is wrong. This was fixed in https://github.com/eclipse/lsp4j/blob/master/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/services/TextDocumentService.java#L96

/**
  * The document highlight request is sent from the client to the server to
  * to resolve a document highlights for a given text document position.
  */
@JsonRequest
CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(TextDocumentPositionParams position);

but Che 5.0.0 is not using the new lsp4j library yet. For the mean time, I can return the first occurence of text to highlight, but I think that Che would need to integrate the Lsp4j lib as soon as a release is published.

vparfonov pushed a commit that referenced this issue Feb 21, 2017
Providing support for occurrences highlighting, with a
restriction due a bug in the io.typefox.lsapi.services 0.3.0
bundle, which assumes that the language server will return
a single occurrence to highlight, instead of a list of
occurrences.

Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
@gorkem
Copy link
Contributor

gorkem commented Mar 29, 2017

@vparfonov @evidolob Can we close this now? Is there anything else that needs to be done?

@ibuziuk ibuziuk closed this as completed Apr 4, 2017
JPinkney pushed a commit to JPinkney/che that referenced this issue Aug 17, 2017
Providing support for occurrences highlighting, with a
restriction due a bug in the io.typefox.lsapi.services 0.3.0
bundle, which assumes that the language server will return
a single occurrence to highlight, instead of a list of
occurrences.

Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A feature request - must adhere to the feature request template.
Projects
None yet
Development

No branches or pull requests

5 participants