Skip to content

Commit

Permalink
Merge pull request #2593 from BetterThanTomorrow/2592-win-jack-in-tak…
Browse files Browse the repository at this point in the history
…e-one-trillion

2592 win jack in take one trillion
  • Loading branch information
PEZ authored Jul 3, 2024
2 parents 32777f5 + 8cf1e5d commit 7d12da4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changes to Calva.
## [Unreleased]

- [Stop offering to use existing temp files when creating a project](https://github.com/BetterThanTomorrow/calva/issues/2589)
- Fix: [Version 2.0.461 of Calva breaks deps.edn jack-in on some Windows machines](https://github.com/BetterThanTomorrow/calva/issues/2592)

## [2.0.461] - 2024-07-01

Expand Down
9 changes: 8 additions & 1 deletion src/nrepl/jack-in.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,14 @@ export async function copyJackInCommandToClipboard(): Promise<void> {
const options = await getJackInTerminalOptions(projectConnectSequence);
if (options) {
void vscode.env.clipboard.writeText(createCommandLine(options));
void vscode.window.showInformationMessage('Jack-in command line copied to the clipboard.');
const message = `Jack-in command line copied to the clipboard.${
projectTypes.isWin ? ' It is tailored for cmd.exe and may not work in other shells.' : ''
}`;
if (projectTypes.isWin) {
void vscode.window.showInformationMessage(message, 'OK');
} else {
void vscode.window.showInformationMessage(message);
}
}
} catch (e) {
void vscode.window.showErrorMessage(`Error creating Jack-in command line: ${e}`, 'OK');
Expand Down
11 changes: 7 additions & 4 deletions src/nrepl/project-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ function depsCljWindowsPath() {
}

const clojureCmdFn = () => {
const q = isWin ? '"' : "'";
const configuredCmd =
getConfig().depsEdnJackInExecutable === 'clojure or deps.clj'
? getStateValue('depsEdnJackInDefaultExecutable') ?? 'deps.clj'
Expand All @@ -339,6 +338,10 @@ const clojureCmdFn = () => {
: ['clojure'];
};

const clojureCmdWinFn = () => {
return ['java', '-jar', `${path.join(state.extensionContext.extensionPath, 'deps.clj.jar')}`];
};

const projectTypes: { [id: string]: ProjectType } = {
lein: {
name: 'Leiningen',
Expand Down Expand Up @@ -375,10 +378,10 @@ const projectTypes: { [id: string]: ProjectType } = {
'ClojureScript built-in for node',
],
cmd: clojureCmdFn,
winCmd: clojureCmdFn,
winCmd: clojureCmdWinFn,
resolveBundledPathWin: depsCljWindowsPath,
processShellUnix: true,
processShellWin: false,
processShellWin: 'cmd.exe',
useWhenExists: ['deps.edn'],
nReplPortFile: ['.nrepl-port'],
/** Build the command line args for a clj-project.
Expand Down Expand Up @@ -669,7 +672,7 @@ async function cljCommandLine(connectSequence: ReplConnectSequence, cljsType: Cl
const aliasesOption =
aliases.length > 0 ? `${aliasesFlag[0]}${aliases.join('')}` : aliasesFlag[1];
const q = isWin ? '"' : "'";
const dQ = isWin ? '""' : '"';
const dQ = isWin ? '\\"' : '"';
for (const dep in dependencies) {
out.push(dep + ` {:mvn/version,${dQ}${dependencies[dep]}${dQ}}`);
}
Expand Down

0 comments on commit 7d12da4

Please sign in to comment.