[VSCode] Set projectPath to workspaceFolder if there's only one repository open in VSCode

Checklist

Summary

When a project is open in VSCode and there are multiple cloned project within the directory, it's setting projectPath to empty string because it can't figure out exactly which repository to choose.

In this case, there's one top-level project open so let's set the projectPath to it to unblock the users from accessing workflow and agentic chat.

Steps to reproduce

  1. Install GDK

  2. Open gdk in VSCode

  3. Click Workflow in the sidebar and you will see this UI

    image.png

What is the current bug behavior?

Can't access the workflow and agentic chat

What is the expected correct behavior?

Access the workflow and the agentic chat

Relevant logs and/or screenshots

Possible fixes

  • Set the workspace folder repository, if available, as the active project
diff --git a/src/desktop/commands/run_with_valid_project.ts b/src/desktop/commands/run_with_valid_project.ts
index 6f33c9e6..5470e8cb 100644
--- a/src/desktop/commands/run_with_valid_project.ts
+++ b/src/desktop/commands/run_with_valid_project.ts
@@ -74,8 +74,14 @@ export const getActiveProject: () => ProjectInRepository | undefined = () => {
   const projects = getProjectRepository().getDefaultAndSelectedProjects();
   if (projects.length === 1) return projects[0];
 
-  return undefined;
-};
+  const { workspaceFolders } = vscode.workspace;
+  if (workspaceFolders && workspaceFolders.length === 1) {
+    const singleWorkspaceFolder = workspaceFolders[0];
+    const repositoryRoot = getRepositoryRootForUri(singleWorkspaceFolder.uri);
+    if (repositoryRoot) {
+      return getProjectRepository().getSelectedOrDefaultForRepository(repositoryRoot);
+    }
+  }
Edited by Juhee Lee