Skip to content

Commit

Permalink
Add jackIn.useDeprecatedAliasFlag
Browse files Browse the repository at this point in the history
This adds an option to use the deprecated -A flag instead of -M for users using Clojure CLI versions < 1.10.697.
  • Loading branch information
stefan-toubia committed Jan 21, 2022
1 parent 1784053 commit fd90ffb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {},
Expand Down
5 changes: 4 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
};
}

Expand Down
4 changes: 3 additions & 1 deletion src/nrepl/project-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fd90ffb

Please sign in to comment.