Skip to content

Commit ae3905a

Browse files
authored
Merge pull request #2636 from djblue/nrepl-middleware
Add `extrNReplMiddleware` to `connectSequence` * Fixes #1691
2 parents 2e84239 + c1f57f0 commit ae3905a

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Changes to Calva.
44

55
## [Unreleased]
66

7+
- [Add `extraNReplMiddleware` to `connectSequence`](https://github.com/BetterThanTomorrow/calva/issues/1691)
8+
79
## [2.0.477] - 2024-09-29
810

911
- Fix: [Global custom repl command keys override workspace dittos, should be the other way around](https://github.com/BetterThanTomorrow/calva/issues/2640)

docs/site/connect-sequences.md

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ A connect sequence configures the following:
4444
* `cljsLaunchBuilds`: The cljs builds to start/watch at Jack-in/connect.
4545
* `cljsDefaultBuild`: Which cljs build to attach to at the initial connect.
4646
* `jackInEnv`: An object with environment variables that will be merged with the global `calva.jackInEnv` and then applied to the Jack-in process. The merge is very similar to how Clojure's `merge` works. So for any common keys between the global setting and this one, the ones from this setting will win.
47+
* `extraNReplMiddleware`: Array of strings of the fully qualified names of extra middleware that should be applied to the nREPL server when started.
4748

4849
The [Calva built-in sequences](https://github.com/BetterThanTomorrow/calva/blob/published/src/nrepl/connectSequence.ts) also use this format, check them out to get a clearer picture of how these settings work.
4950

src/nrepl/connectSequence.ts

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ interface ReplConnectSequence {
6767
cljsType: CljsTypes | CljsTypeConfig;
6868
menuSelections?: MenuSelections;
6969
nReplPortFile?: string[];
70+
extraNReplMiddleware?: string[];
7071
jackInEnv?: Record<string, string>;
7172
}
7273

src/nrepl/project-types.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,11 @@ async function cljCommandLine(connectSequence: ReplConnectSequence, cljsType: Cl
668668
...(cljsType ? { ...cljsDependencies()[cljsType] } : {}),
669669
...serverPrinterDependencies,
670670
};
671-
const useMiddleware = [...middleware, ...(cljsType ? cljsMiddleware[cljsType] : [])];
671+
const useMiddleware = [
672+
...middleware,
673+
...(cljsType ? cljsMiddleware[cljsType] : []),
674+
...(connectSequence.extraNReplMiddleware || []),
675+
];
672676

673677
const aliasesFlag = getStateValue('isClojureCLIVersionAncient') ? ['-A', ''] : ['-M', '-M'];
674678
const aliasesOption =

0 commit comments

Comments
 (0)