You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by en...@apache.org on 2021/12/15 22:14:53 UTC

[netbeans] 01/02: Single file Groovy Run and Debug in VSCode.

This is an automated email from the ASF dual-hosted git repository.

entl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git

commit e4f2431a70ba4561adbca0c67fe44016c97aaabc
Author: Martin Entlicher <ma...@oracle.com>
AuthorDate: Tue Dec 14 02:30:24 2021 +0100

    Single file Groovy Run and Debug in VSCode.
---
 .../lsp/server/debugging/breakpoints/GroovyBreakpointFactory.java    | 5 +++++
 .../modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java   | 4 ++--
 .../modules/java/lsp/server/protocol/WorkspaceServiceImpl.java       | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/breakpoints/GroovyBreakpointFactory.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/breakpoints/GroovyBreakpointFactory.java
index b83c3ce..eee3c1b 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/breakpoints/GroovyBreakpointFactory.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/breakpoints/GroovyBreakpointFactory.java
@@ -87,6 +87,11 @@ public class GroovyBreakpointFactory {
                     b.setSourcePath(relativePath);
                     return relativePath;
                 }
+            } else {
+                // Suppose the current folder
+                String relativePath = fo.getNameExt();
+                b.setSourcePath(relativePath);
+                return relativePath;
             }
         }
         return null;
diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java
index 07f2c73..58fe932 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java
@@ -542,13 +542,13 @@ public abstract class NbLaunchDelegate {
         ActionProvider provider = null;
         String command = null;
         Collection<ActionProvider> actionProviders = findActionProviders(prj);
-        Lookup testLookup = preferProjActions ? Lookups.singleton(prj) : (singleMethod != null) ? Lookups.fixed(toRun, singleMethod) : Lookups.singleton(toRun);
+        Lookup testLookup = preferProjActions && prj != null ? Lookups.singleton(prj) : (singleMethod != null) ? Lookups.fixed(toRun, singleMethod) : Lookups.singleton(toRun);
         String[] actions;
         if (!mainSource && singleMethod != null) {
             actions = debug ? new String[] {SingleMethod.COMMAND_DEBUG_SINGLE_METHOD}
                             : new String[] {SingleMethod.COMMAND_RUN_SINGLE_METHOD};
         } else {
-            if (preferProjActions) {
+            if (preferProjActions && prj != null) {
                 actions = debug ? mainSource ? new String[] {ActionProvider.COMMAND_DEBUG}
                                              : new String[] {ActionProvider.COMMAND_DEBUG_TEST_SINGLE, ActionProvider.COMMAND_DEBUG}
                                 : mainSource ? new String[] {ActionProvider.COMMAND_RUN}
diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceServiceImpl.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceServiceImpl.java
index 3539d71..44b9f9f 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceServiceImpl.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceServiceImpl.java
@@ -507,7 +507,7 @@ public final class WorkspaceServiceImpl implements WorkspaceService, LanguageCli
     private CompletableFuture<Object> findProjectConfigurations(FileObject ownedFile) {
         return server.asyncOpenFileOwner(ownedFile).thenApply(p -> {
             if (p == null) {
-                return CompletableFuture.completedFuture(Collections.emptyList());
+                return Collections.emptyList();
             }
             ProjectConfigurationProvider<ProjectConfiguration> provider = p.getLookup().lookup(ProjectConfigurationProvider.class);
             List<String> configDispNames = new ArrayList<>();

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

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