Support inlay hints for parameter names#2019
Conversation
|
Just wondering. Is there a reason to go through the delegate API ( |
|
I implemented inlayhint too for Qute, see my PR https://github.com/redhat-developer/quarkus-ls/pull/593/files The main idea is that I define an interface which follow the LSP spec with InlayHint, InlayHintParams LSP structures. package org.eclipse.lsp4j.proposed;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.eclipse.lsp4j.jsonrpc.services.JsonRequest;
public interface QuteInlayHintProvider {
@JsonRequest("qute/textDocument/inlayHint")
default CompletableFuture<List<InlayHint>> inlayHint(InlayHintParams params) {
throw new UnsupportedOperationException();
}
}Please note that I defined "qute/textDocument/inlayHint" but when LSP4J will be released, we don't need this interface. The QuteInlayHintProvider implements my LanguageServer implementation. On client side,I use sendRequest to consume inlay hint https://github.com/redhat-developer/vscode-quarkus/pull/474/files#diff-aeb59384a9e0b18adc89b06d548c119ed02ead2a48e1c11a26eb4972409dfe27R57 |
|
Thank you for sharing the information and the proposed implementation. My personal opinion is that these are just two different ways of the implementation but with the same purpose. Finally when the structures of Inlay hints are added in LSP4J, those codes will be removed. So I prefer chose the easy way to do it as for now. |
|
@jdneo I changed my strategy, and now I'musing the real LSP request type package org.eclipse.lsp4j.proposed;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.eclipse.lsp4j.jsonrpc.services.JsonRequest;
public interface QuteInlayHintProvider {
@JsonRequest("textDocument/inlayHint")
default CompletableFuture<List<InlayHint>> inlayHint(InlayHintParams params) {
throw new UnsupportedOperationException();
}
}It means that when vscode-language-client will be released (the master ofvscode-language-client already implement the request type On server side, when LSP4J will be removed, I will remove all my code from my In otherwise for client and server side, it will be just a matter of remove code and adapt some package without developping something. |
|
Sounds cool! @testforstephen @rgrunber Any input about this? |
e197971 to
b947f38
Compare
|
This checks |
This PR supports inlay hints for parameter names. Meanwhile, a new preference InlayHintsParameterModeis added to specify how the inlay hints will be displayed in editor, where: - NONE: do not show inlay hints - LITERALS: only show inlay hints for literal arguments - ALL: show inlay hints for both literal and non-literal arguments Signed-off-by: sheche <sheche@microsoft.com>
Thanks for reminding. Sure and besides |
rgrunber
left a comment
There was a problem hiding this comment.
Overall, change works well for me. Once addressed, I think this is ready to be merged.
Signed-off-by: sheche <sheche@microsoft.com>
fix redhat-developer/vscode-java#2099
requires redhat-developer/vscode-java#2354
Signed-off-by: sheche sheche@microsoft.com