You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "sdedic (via GitHub)" <gi...@apache.org> on 2023/05/12 10:23:55 UTC

[GitHub] [netbeans] sdedic commented on a diff in pull request #5938: VSCode: Stacktraces in test exceptions should be clickable.

sdedic commented on code in PR #5938:
URL: https://github.com/apache/netbeans/pull/5938#discussion_r1192178399


##########
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceServiceImpl.java:
##########
@@ -397,6 +398,47 @@ public CompletableFuture<Object> executeCommand(ExecuteCommandParams params) {
                     return future;
                 });
             }
+            case Server.JAVA_RESOLVE_STACKTRACE_LOCATION: {
+                CompletableFuture<Object> future = new CompletableFuture<>();
+                try {
+                    String uri = ((JsonPrimitive) params.getArguments().get(0)).getAsString();

Review Comment:
   Possibly guard against `params.getArguments().size() < 3`



##########
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceServiceImpl.java:
##########
@@ -397,6 +398,47 @@ public CompletableFuture<Object> executeCommand(ExecuteCommandParams params) {
                     return future;
                 });
             }
+            case Server.JAVA_RESOLVE_STACKTRACE_LOCATION: {
+                CompletableFuture<Object> future = new CompletableFuture<>();
+                try {
+                    String uri = ((JsonPrimitive) params.getArguments().get(0)).getAsString();
+                    String methodName = ((JsonPrimitive) params.getArguments().get(1)).getAsString();
+                    String fileName = ((JsonPrimitive) params.getArguments().get(2)).getAsString();
+
+                    FileObject fo = Utils.fromUri(uri);
+                    ClassPath classPath = ClassPathSupport.createProxyClassPath(new ClassPath[] {
+                        ClassPath.getClassPath(fo, ClassPath.EXECUTE),
+                        ClassPath.getClassPath(fo, ClassPath.BOOT)
+                    });
+
+                    String name = fileName.substring(0, fileName.lastIndexOf('.'));

Review Comment:
   this could eventually work for `.groovy` source files as well, right ?



##########
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceServiceImpl.java:
##########
@@ -397,6 +398,47 @@ public CompletableFuture<Object> executeCommand(ExecuteCommandParams params) {
                     return future;
                 });
             }
+            case Server.JAVA_RESOLVE_STACKTRACE_LOCATION: {
+                CompletableFuture<Object> future = new CompletableFuture<>();
+                try {
+                    String uri = ((JsonPrimitive) params.getArguments().get(0)).getAsString();
+                    String methodName = ((JsonPrimitive) params.getArguments().get(1)).getAsString();
+                    String fileName = ((JsonPrimitive) params.getArguments().get(2)).getAsString();
+
+                    FileObject fo = Utils.fromUri(uri);
+                    ClassPath classPath = ClassPathSupport.createProxyClassPath(new ClassPath[] {

Review Comment:
   Guard against `fo == null`, will NPE in `getClassPath`



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

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