Calva: Jack in shadow-cljs, command in output ends up as "npx <"

Created on 15 Aug 2019  路  17Comments  路  Source: BetterThanTomorrow/calva

When running jack in and selecting shadow-cljs it ends up running "npx <".

Running on Linux.

Task output:

> Executing task: npx <


ERROR: You must supply a command.

Execute binaries from npm packages.

  npx [options] <command>[@version] [command-arg]...

  npx [options] [-p|--package <package>]... <command> [command-arg]...

  npx [options] -c '<command-string>'

  npx --shell-auto-fallback [shell]
.....
help wanted jack-in

Most helpful comment

Thanks! I can reproduce this on my Mac now. Or something similar to it:

  • If I select build using the mouse, the build's selection status gets toggled, and the menu stays open.
  • If I press enter when a build is highlighted, nothing happens with the build's selection, and the menu is submitted.

So, at least on Mac, the UI seems to be designed such that enter submits the menu and mouse click on a menu item toggles it. space is used for toggling the selection using the keyboard.

The real bug here is that Calva does not validate the selection.

All 17 comments

Thanks! What shell do you use as default in VS Code?

My default shell is fish

Edit: Changed my shell in VSCode to bash but still have the same problem.

Thanks for making that test. It was the next thing I was going to ask you to do of course. :smile: Now I am out of ideas. But also, I am looking a bit more closely on the output you have provided. It doesn't look like a quoting issue at all (which I initially thought it might be).

Some more questions then:

  1. Which version of Calva are you using?
  2. Do you get the popup asking which builds to start, before the task is started?

The version is 2.0.31

I do get the popup asking which build to use

edit: the dependency issue is unrelated, I'm still reproducing the issue with a valid shadow-cljs config.

@Tebro By any chance, do you have some dependency name as string? e.g.:

{:source-paths
 ["..."]

 :dependencies
 [["whatever.awesome/dependency" "x.x.x"]] ; <- Here, double-quotes around the name

 :builds
 {}}

In which case, does turning it into a symbol fix the issue? e.g.:

{:source-paths
 ["..."]

 :dependencies
 [[whatever.awesome/dependency "x.x.x"]] ; <- Same without the double-quotes for name

 :builds
 {}}

I believe I switched between mouse and keyboard without thinking about it to select the build(s) while trying to reproduce the issue...

What seems to work every time:

  • Run the Calva: Start a project REPL and connect (aka Jack-In) command
  • Check at least 1 build using the mouse and click on OK

What seems to fail every time:

  • Run the Calva: Start a project REPL and connect (aka Jack-In) command
  • Make sure no build is selected and the Select builds to start is focused
  • Move to the first build using down arrow on keyboard and press Enter

Mouse-selected build(s) are automatically selected on next run, I believe this is was the error was magically disappearing, even when using the keyboard.

I'll try to reproduce in debug mode this evening to make sure it actually produces the broken build data that makes the npx command fail.

Thanks! I can reproduce this on my Mac now. Or something similar to it:

  • If I select build using the mouse, the build's selection status gets toggled, and the menu stays open.
  • If I press enter when a build is highlighted, nothing happens with the build's selection, and the menu is submitted.

So, at least on Mac, the UI seems to be designed such that enter submits the menu and mouse click on a menu item toggles it. space is used for toggling the selection using the keyboard.

The real bug here is that Calva does not validate the selection.

When opening the command palette with ctrl+shift+p, typing a few chars + some arrow keys to retrieve the Jack-in command, then validating with enter, the build selection box shows at the same place and also looks like some kind of drop-down menu, so couldn't one easily assume builds can be selected the same way as commands?

Also, when typing esc from the build selection box, the npx command is run (ending up with the same error).

Would making those small UX improvements be valuable?

The menu is a built in vscode widget, and I don't think it allows for altering that behaviour. The difference between the builds menu and the Jack-in project type menu is that the builds menu allows multiple selections. So there is an OK button there which is bound to the enter key.

Here's the API for the QuickPick widget: https://code.visualstudio.com/api/references/vscode-api#QuickPick

I have added some validation for this in the branch were we are reworking much of the jack-in code. It now aborts the jack-in when there is no build selected, including when esc is pressed. That's better, but there will still be a problem for when the user wants to select more than one build and presses enter on the last one, thinking that selects it, a situation I can't detect. But maybe, by then the user has learnt how the UI works.

Reading through this it makes sense, I no longer use VSCode for Clojure (for other reasons), but good to know this helps others.

What are you using instead, if I may ask?

VIM.

Edit: Calva is better Clojure tooling, but is not compatible with the VSCode VIM plugin which in itself is already a step down from just vim. So after weighing all of these points I ended up going back.

Thanks for clarifying it a bit. I didn't know Calva and the VIM Plugin were incompatible. Is it something else than what is covered here?

(As an old vi user, I often have found the vi modes in other editors quite underwhelming, evil mode in Emacs being an exception.)

In my opinion the paredit part is fundamentally incompatible with (at least my style of) vim editing. I tried to go without the vi mode, but it seems I can no longer function without it.

I agree with your comment about evil being the only vi mode that works well.

If you have some time, I'd like to chat some about this. Not sure I can do very much about it, but at least I'd be more informed about the problem. You'll find me as @pez on Clojurian's Slack.

Closing this, as there is not very much we can do about it at the Calva end of things.

Was this page helpful?
0 / 5 - 0 ratings