junichi11 commented on a change in pull request #1508: Improving code 
completion appearance for both LSP client and Java LSP…
URL: https://github.com/apache/netbeans/pull/1508#discussion_r324518669
 
 

 ##########
 File path: 
ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/CompletionProviderImpl.java
 ##########
 @@ -226,36 +223,66 @@ public void render(Graphics grphcs, Font font, Color 
color, Color color1, int i,
 
                             @Override
                             public CompletionTask createDocumentationTask() {
-                                return new CompletionTask() {
+                                return new AsyncCompletionTask(new 
AsyncCompletionQuery() {
                                     @Override
-                                    public void query(CompletionResultSet 
resultSet) {
-                                        resultSet.setDocumentation(new 
CompletionDocumentation() {
-                                            @Override
-                                            public String getText() {
-                                                return documentation;
-                                            }
-                                            @Override
-                                            public URL getURL() {
-                                                return null;
-                                            }
-                                            @Override
-                                            public CompletionDocumentation 
resolveLink(String link) {
-                                                return null;
+                                    protected void query(CompletionResultSet 
resultSet, Document doc, int caretOffset) {
+                                        CompletionItem resolved;
+                                        if ((i.getDetail() == null || 
i.getDocumentation() == null) && hasCompletionResolve(server)) {
+                                            CompletionItem temp;
+                                            try {
+                                                temp = 
server.getTextDocumentService().resolveCompletionItem(i).get();
+                                            } catch (InterruptedException | 
ExecutionException ex) {
+                                                Exceptions.printStackTrace(ex);
+                                                temp = i;
                                             }
-                                            @Override
-                                            public Action 
getGotoSourceAction() {
-                                                return null;
-                                            }
-                                        });
+                                            resolved = temp;
+                                        } else {
+                                            resolved = i;
+                                        }
+                                        if (resolved.getDocumentation() != 
null || resolved.getDetail() != null) {
+                                            resultSet.setDocumentation(new 
CompletionDocumentation() {
+                                                @Override
+                                                public String getText() {
+                                                    StringBuilder 
documentation = new StringBuilder();
+                                                    
documentation.append("<html>\n");
 
 Review comment:
   should add `NOI18N`s?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to