Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2592 win jack in take one trillion #2593

Merged
merged 5 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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