Skip to content

Commit 3f0e89a

Browse files
committed
Move rootProjectDir to root of replConnectSequences
1 parent 1fe61c4 commit 3f0e89a

File tree

6 files changed

+10
-8
lines changed

6 files changed

+10
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Changes to Calva.
33

44
## [Unreleased]
5-
- Add replConnectSequences.menuSelections.projectRootDir for manually specifying the root directory in order to support jack-in for monorepo projects.
5+
- Add replConnectSequences.projectRootDir for manually specifying the root directory in order to support jack-in for monorepo projects.
66
- Fix so that Calva treats symbol containing the quote character correctly.
77
- [Fix: Parameter hints popup should be off by default](https://github.com/BetterThanTomorrow/calva/issues/574)
88

docs/readthedocs/source/connect-sequences.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ A connect sequence configures the following:
1616
* `projectType`: (required) This is either "Leiningen”, ”Clojure-CLI”, or ”shadow-cljs”.
1717
* `nReplPortFile`: An array of path segments with the project root-relative path to the nREPL port file for this connect sequence. E.g. For shadow-cljs this would be `[".shadow-cljs", "nrepl.port"]`.
1818
* `afterCLJReplJackInCode`: Here you can give Calva some Clojure code to evaluate in the CLJ REPL, once it has been created.
19+
* `projectRootDir`: The root directory to execute the Jack-in command from. This will override the default behavior for determining the root directory relative to the current open file. This is useful for working in monorepos.
1920
* `cljsType`: This can be either "Figwheel Main", "lein-figwheel", "shadow-cljs", "Nashorn", or a dictionary configuring a custom type. If omitted, Calva will skip connecting a ClojureScript repl. A custom type has the following fields:
2021
* `dependsOn`: (required) Calva will use this to determine which dependencies it will add when starting the project (Jacking in). This can be either "Figwheel Main", "lein-figwheel", "shadow-cljs", "Nashorn", or ”User provided”. If it is "User provided", then you need to provide the dependencies in the project, or launch with an alias (deps.edn), profile (Leiningen), or build (shadow-cljs) that provides the dependencies needed.
2122
* `isStarted`: Boolean. For CLJS REPLs that Calva does not need to start, set this to true. (If you base your custom cljs repl on a shadow-cljs workflow, for instance.)
@@ -33,7 +34,6 @@ A connect sequence configures the following:
3334
* `cljAliases`: At Jack-in to a Clojure CLI project, use these aliases to launch the repl.
3435
* `cljsLaunchBuilds`: The cljs builds to start/watch at Jack-in/connect.
3536
* `cljsDefaultBuild`: Which cljs build to attach to at the initial connect.
36-
* `projectRootDir`: The root directory to execute the Jack-in command from. This will override the default behavior for determining the root directory relative to the current open file. This is useful for working in monorepos.
3737

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

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,11 @@
375375
"description": "Here you can give Calva some Clojure code to evaluate in the CLJ REPL, once it has been created.",
376376
"required": false
377377
},
378+
"projectRootDir": {
379+
"type": "string",
380+
"descripion": "Defines the project root directory. Useful for working with monorepos.",
381+
"required": false
382+
},
378383
"menuSelections": {
379384
"type": "object",
380385
"description": "Pre-selected menu options. If a slection is made here. Calva won't prompt for it.",
@@ -414,10 +419,6 @@
414419
"cljsDefaultBuild": {
415420
"type": "string",
416421
"description": "Which cljs build to attach to at the initial connect."
417-
},
418-
"projectRootDir": {
419-
"type": "string",
420-
"descripion": "Defines the project root directory. Useful for working with monorepos."
421422
}
422423
}
423424
},

src/nrepl/connectSequence.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ interface MenuSelections {
3939
cljAliases?: string[],
4040
cljsLaunchBuilds?: string[],
4141
cljsDefaultBuild?: string,
42-
projectRootDir?: string,
4342
}
4443

4544
interface ReplConnectSequence {
4645
name: string,
4746
projectType: ProjectTypes,
4847
afterCLJReplJackInCode?: string,
48+
projectRootDir?: string,
4949
cljsType: CljsTypes | CljsTypeConfig,
5050
menuSelections?: MenuSelections,
5151
nReplPortFile?: string[]

src/nrepl/jack-in.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function cancelJackInTask() {
4242

4343
async function executeJackInTask(projectType: projectTypes.ProjectType, projectTypeSelection: any, executable: string, args: any, cljTypes: string[], outputChannel: vscode.OutputChannel, connectSequence: ReplConnectSequence) {
4444
// If the connection sequence specifies a project root dir, override the existing project dir
45-
const projectRootDir = connectSequence?.menuSelections?.projectRootDir;
45+
const projectRootDir = connectSequence?.projectRootDir;
4646
if(projectRootDir) state.setProjectRoot(projectRootDir);
4747

4848
utilities.setLaunchingState(projectTypeSelection);

src/state.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ export function getProjectWsFolder(): vscode.WorkspaceFolder {
177177
* by looking for project files from the file's directory and up to
178178
* the window root (for plain folder windows) or the file's
179179
* workspace folder root (for workspaces) to find the project root.
180+
*
180181
* If there is no project file found, throw an exception.
181182
*/
182183
export async function initProjectDir(): Promise<void> {

0 commit comments

Comments
 (0)