From fd90ffb20ffac52ce43c3e6212ebfbd6c5c45511 Mon Sep 17 00:00:00 2001 From: Stefan Toubia Date: Thu, 20 Jan 2022 18:54:24 -0800 Subject: [PATCH] Add jackIn.useDeprecatedAliasFlag This adds an option to use the deprecated -A flag instead of -M for users using Clojure CLI versions < 1.10.697. --- CHANGELOG.md | 1 + package.json | 5 +++++ src/config.ts | 5 ++++- src/nrepl/project-types.ts | 4 +++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index effbf0311..c0b543783 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Changes to Calva. ## [Unreleased] +- [Continue to support -Aalias for jack-in](https://github.com/BetterThanTomorrow/calva/issues/1474) - [Add custom commands from libraries](https://github.com/BetterThanTomorrow/calva/pull/1442) - Workaround: [VS Code highlights characters in the output/REPL window prompt](https://github.com/BetterThanTomorrow/calva/pull/1475) diff --git a/package.json b/package.json index f6b9256cc..1d4521c6d 100644 --- a/package.json +++ b/package.json @@ -331,6 +331,11 @@ "calva.customCljsRepl": { "deprecationMessage": "This settings is deprecated. Use `cljsType` in a `calva.replConnectSequences` item instead." }, + "calva.jackIn.useDeprecatedAliasFlag": { + "type": "boolean", + "default": false, + "markdownDescription": "Use the `-A` flag instead of `-M` for Clojure CLI versions < `1.10.697`." + }, "calva.jackInEnv": { "type": "object", "default": {}, diff --git a/src/config.ts b/src/config.ts index 4c8f227d8..78110d44b 100644 --- a/src/config.ts +++ b/src/config.ts @@ -99,7 +99,10 @@ function getConfig() { referencesCodeLensEnabled: configOptions.get('referencesCodeLens.enabled') as boolean, hideReplUi: configOptions.get('hideReplUi') as boolean, strictPreventUnmatchedClosingBracket: pareditOptions.get('strictPreventUnmatchedClosingBracket'), - showCalvaSaysOnStart: configOptions.get("showCalvaSaysOnStart") as boolean + showCalvaSaysOnStart: configOptions.get("showCalvaSaysOnStart") as boolean, + jackIn: { + useDeprecatedAliasFlag: configOptions.get("jackIn.useDeprecatedAliasFlag") as boolean, + } }; } diff --git a/src/nrepl/project-types.ts b/src/nrepl/project-types.ts index 76a5bf1a8..de74cc2e7 100644 --- a/src/nrepl/project-types.ts +++ b/src/nrepl/project-types.ts @@ -473,7 +473,9 @@ async function cljCommandLine(connectSequence: ReplConnectSequence, cljsType: Cl ...serverPrinterDependencies }; const useMiddleware = [...middleware, ...(cljsType ? cljsMiddleware[cljsType] : [])]; - const aliasesOption = aliases.length > 0 ? `-M${aliases.join("")}` : '-M'; + + const aliasesFlag = getConfig().jackIn.useDeprecatedAliasFlag ? ['-A', ''] : ['-M', '-M']; + const aliasesOption = aliases.length > 0 ? `${aliasesFlag[0]}${aliases.join("")}` : aliasesFlag[1]; const q = isWin ? '"' : "'"; const dQ = isWin ? '""' : '"'; for (let dep in dependencies)