Skip to content

Commit

Permalink
1846 deps clj (#1847)
Browse files Browse the repository at this point in the history
* Update deps.clj to 0.1.1100

* Make the deps.edn start executable configurable

Fixes #1846

* Update changelog about deps.clj bump

* Update jack-in integration test
  • Loading branch information
PEZ authored Aug 29, 2022
1 parent 0a2f782 commit e8ba911
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 5 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Changes to Calva.

## [Unreleased]

[Rich comment handling in notebooks](https://github.com/BetterThanTomorrow/calva/issues/1845)
- [Rich comment handling in notebooks](https://github.com/BetterThanTomorrow/calva/issues/1845)
- [Default to use deps.clj instead of clojure for starting deps.edn projects](https://github.com/BetterThanTomorrow/calva/issues/1846)
- Update deps.clj to version 0.1.1100

## [2.0.295] - 2022-08-28

Expand Down
Binary file modified deps.clj.jar
Binary file not shown.
1 change: 1 addition & 0 deletions docs/site/connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ There are also these settings:
* `calva.myCljAliases`: An array of `deps.edn` aliases not found in the project file. Use this to tell Calva Jack-in to launch your REPL using your user defined aliases.
* `calva.myLeinProfiles`: An array of Leiningen profiles not found in `project.clj`. Use this to tell Calva Jack-in to launch your REPL using your user defined profiles.
* `calva.openBrowserWhenFigwheelStarted`: _For Legacy Figwheel only._ A boolean controlling if Calva should automatically launch your ClojureScript app, once it is compiled by Figwheel. Defaults to `true`.
* `calva.depsEdnJackInExecutable`: A string which should either be `clojure` or `deps.clj` (default). It determines which executable Calva Jack-in should use for starting a deps.edn project. Use `clojure` if you have it installed and it works. If you run into troubles you can revert back to the default of using `deps.clj`, which is bundled with Calva.

!!! Note
When processing the `calva.jackInEnv` setting you can refer to existing ENV variables with `${env:VARIABLE}`.
Expand Down
3 changes: 3 additions & 0 deletions docs/site/jack-in-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,13 @@ If your full stack project is using shadow-cljs for the frontend, like [this Ful

See [Workspace Layouts](workspace-layouts.md) for tips about how to open the same project folder in two separate VS Code windows.

Please also consider to play around with starting the REPL and ClojureScript wiring entirely from the terminal, see [this example project](https://github.com/PEZ/shadow-w-backend) for some instructions on that. You can also use that project together with the `nil` for `connectCode` sequence mentioned above.

## Please Grab your Calva Jack-In Certificate

There, you now know all there is to know about Calva Jack-In.

Just kidding, there are a few more details to it, some of which might find their way into this article at a later time.

To really get to know it all, you will need to spend some time with the Calva Jack-In code. Head over to the [Calva Development Wiki](https://github.com/BetterThanTomorrow/calva/wiki) to learn how to hack on Calva.

9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,15 @@
"repl",
"lsp"
]
},
"calva.depsEdnJackInExecutable": {
"markdownDescription": "Which executable should Calva Jack-in use for starting a deps.edn project? Use `clojure` if you have it installed and it works. If you run into troubles you can revert back to the default of using `deps.clj`, which is bundled with Calva.",
"enum": [
"clojure",
"deps.clj"
],
"default": "deps.clj",
"type": "string"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ function getConfig() {
projectRootsSearchExclude: configOptions.get<string[]>('projectRootsSearchExclude', []),
useLiveShare: configOptions.get<boolean>('useLiveShare'),
definitionProviderPriority: configOptions.get<string[]>('definitionProviderPriority'),
depsEdnJackInExecutable: configOptions.get<string>('depsEdnJackInExecutable'),
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/extension-test/integration/suite/jack-in-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ suite('Jack-in suite', () => {

const cmdLine = await vscode.env.clipboard.readText();

assert.ok(cmdLine.startsWith('clojure'));
assert.ok(cmdLine.includes('deps.clj.jar'));

await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
testUtil.log(suite, 'test.clj closed');
Expand Down
2 changes: 1 addition & 1 deletion src/nrepl/jack-in.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ async function getJackInTerminalOptions(
cmd = [...cmd, projectType.resolveBundledPathWin()];
}
} else {
cmd = projectType.cmd;
cmd = typeof projectType.cmd === 'function' ? projectType.cmd() : projectType.cmd;
if (projectType.resolveBundledPathUnix) {
cmd = [...cmd, projectType.resolveBundledPathUnix()];
}
Expand Down
7 changes: 5 additions & 2 deletions src/nrepl/project-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const isWin = /^win/.test(process.platform);
export type ProjectType = {
name: string;
cljsTypes?: string[];
cmd?: string[];
cmd?: string[] | (() => string[]);
winCmd?: string[];
resolveBundledPathWin?: () => string;
resolveBundledPathUnix?: () => string;
Expand Down Expand Up @@ -325,7 +325,10 @@ const projectTypes: { [id: string]: ProjectType } = {
'ClojureScript built-in for browser',
'ClojureScript built-in for node',
],
cmd: ['clojure'],
cmd: () =>
getConfig().depsEdnJackInExecutable === 'deps.clj'
? ['java', '-jar', `'${path.join(state.extensionContext.extensionPath, 'deps.clj.jar')}'`]
: ['clojure'],
winCmd: ['java', '-jar'],
resolveBundledPathWin: depsCljWindowsPath,
processShellUnix: true,
Expand Down

0 comments on commit e8ba911

Please sign in to comment.