You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2021/06/07 18:33:45 UTC

[GitHub] [netbeans-html4j] JaroslavTulach opened a new pull request #36: Code completions for callbacks from JavaScript to Java

JaroslavTulach opened a new pull request #36:
URL: https://github.com/apache/netbeans-html4j/pull/36


   Support for `@JavaScriptBody` annotation completions. The callback syntax is described at [net.java.html.js package](https://bits.netbeans.org/html+java/1.7.1/net/java/html/js/package-summary.html). A `body` attribute can contain `@fqn::method(paramTypes)(values)` static callbacks and `arg.@fqn::method(paramTypes)(values)` instance callback. The code completion should work on `x.@|`, `@java.lang.|` locations to completeclass names and then also method names.
   
   The code complation seems to work in NetBeans IDE. I haven't got it working in VSCode yet.
   
   ![obrazek](https://user-images.githubusercontent.com/26887752/121070397-f7d42d00-c7ce-11eb-90fa-bec9a521e508.png)
   ![obrazek](https://user-images.githubusercontent.com/26887752/121070489-133f3800-c7cf-11eb-81fc-c6960970dbf6.png)
   
   Try the completion on [Bodies.java](https://github.com/apache/netbeans-html4j/blob/master/json-tck/src/main/java/net/java/html/js/tests/Bodies.java) for example.


-- 
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:
users@infra.apache.org



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

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


[GitHub] [netbeans-html4j] JaroslavTulach merged pull request #36: Code completions for callbacks from JavaScript to Java

Posted by GitBox <gi...@apache.org>.
JaroslavTulach merged pull request #36:
URL: https://github.com/apache/netbeans-html4j/pull/36


   


-- 
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:
users@infra.apache.org



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

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


[GitHub] [netbeans-html4j] dbalek commented on a change in pull request #36: Code completions for callbacks from JavaScript to Java

Posted by GitBox <gi...@apache.org>.
dbalek commented on a change in pull request #36:
URL: https://github.com/apache/netbeans-html4j/pull/36#discussion_r647302041



##########
File path: boot/src/main/java/org/netbeans/html/boot/impl/JavaScriptProcesor.java
##########
@@ -234,18 +235,127 @@ private boolean verifyResourceAtPath(final String res, StandardLocation location
     public Iterable<? extends Completion> getCompletions(Element e,
         AnnotationMirror annotation, ExecutableElement member, String userText
     ) {
+        if (e.getKind() == ElementKind.METHOD && member.getSimpleName().contentEquals("args")) { // NOI18N
+            return argsCompletion(e);
+        }
+        if (e.getKind() == ElementKind.METHOD && member.getSimpleName().contentEquals("body")) { // NOI18N
+            return bodyCompletion(e, userText);
+        }
+        return null;

Review comment:
       Better to return an empty iterable than `null` as suggested by https://docs.oracle.com/javase/7/docs/api/javax/annotation/processing/Processor.html#getCompletions(javax.lang.model.element.Element,%20javax.lang.model.element.AnnotationMirror,%20javax.lang.model.element.ExecutableElement,%20java.lang.String)




-- 
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:
users@infra.apache.org



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

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


[GitHub] [netbeans-html4j] JaroslavTulach commented on a change in pull request #36: Code completions for callbacks from JavaScript to Java

Posted by GitBox <gi...@apache.org>.
JaroslavTulach commented on a change in pull request #36:
URL: https://github.com/apache/netbeans-html4j/pull/36#discussion_r647362719



##########
File path: boot/src/main/java/org/netbeans/html/boot/impl/JavaScriptProcesor.java
##########
@@ -234,18 +235,127 @@ private boolean verifyResourceAtPath(final String res, StandardLocation location
     public Iterable<? extends Completion> getCompletions(Element e,
         AnnotationMirror annotation, ExecutableElement member, String userText
     ) {
+        if (e.getKind() == ElementKind.METHOD && member.getSimpleName().contentEquals("args")) { // NOI18N
+            return argsCompletion(e);
+        }
+        if (e.getKind() == ElementKind.METHOD && member.getSimpleName().contentEquals("body")) { // NOI18N
+            return bodyCompletion(e, userText);
+        }
+        return null;

Review comment:
       OK. Done in f0fb2a2




-- 
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:
users@infra.apache.org



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

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