From 8948e8eb6420e9b727d09bbedd4a8bc00f6ec105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Str=C3=B6mberg?= Date: Mon, 30 Sep 2024 23:07:12 +0200 Subject: [PATCH] Initiate dram start + jack-in if project is created in the current folder * Fixes #2644 --- CHANGELOG.md | 2 ++ src/nrepl/drams.ts | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4038945f5..eb14051a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ Changes to Calva. ## [Unreleased] +- [Autostart REPL in created projects, also when created in the current folder](https://github.com/BetterThanTomorrow/calva/issues/2644) + ## [2.0.478] - 2024-09-30 - [Add `extraNReplMiddleware` to `connectSequence`](https://github.com/BetterThanTomorrow/calva/issues/1691) diff --git a/src/nrepl/drams.ts b/src/nrepl/drams.ts index 566fe72f2..009daf1c1 100644 --- a/src/nrepl/drams.ts +++ b/src/nrepl/drams.ts @@ -226,7 +226,14 @@ export async function createAndOpenDram( await serializeDramStartConfig(projectRootUri, { config }); - return vscode.commands.executeCommand('vscode.openFolder', projectRootUri, true); + const currentWorkspaceFolder = vscode.workspace.workspaceFolders?.[0]; + + if (currentWorkspaceFolder && currentWorkspaceFolder.uri.fsPath === projectRootUri.fsPath) { + await startDram(); + return vscode.commands.executeCommand('calva.jackIn'); + } else { + return vscode.commands.executeCommand('vscode.openFolder', projectRootUri, true); + } } function ARGS_FILE_PATH(projectRootUri: vscode.Uri) {