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

deps.edn + shadow-cljs jack-in fails, when connect sequence builds are not keywords #2242

Closed
zilti opened this issue Jul 5, 2023 · 3 comments
Labels
bug Something isn't working cljs ClojureScript-related configuration jack-in

Comments

@zilti
Copy link

zilti commented Jul 5, 2023

There is something weird going on with jacking in to a project, depending on if it's done by manually selecting the menu options, or by having them as a configuration in settings.json.

Here's the approach that works:

  • Start the jack-in dialog;
  • Select deps.edn + shadow-cljs;
  • Choose the aliases - in my case :dev/deps and :dev/env;
  • Choose the launch builds - in my case :app and :portfolio;
  • Choose the default build - in my case :app.

Now, to my understanding, this translates to the following replConnectSequence for settings.json:

{
  "name": "redsky Server + Client",
  "projectType": "deps.edn",
  "cljsType": "shadow-cljs",
  "menuSelections": {
    "cljAliases": [
      "dev/deps",
      "dev/env"
    ],
    "cljsLaunchBuilds": [
      "app",
      "portfolio"
    ],
    "cljsDefaultBuild": "app"
  }
}

The approach in that case should be to open the jack-in dialog, and select "redsky Server + Client". This does manage to start the clj portion of it apparently, but then fails.

The command it runs is:

clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.0.0"},cider/cider-nrepl {:mvn/version,"0.28.5"}}}' -M:dev/deps:dev/env -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware shadow.cljs.devtools.server.nrepl/middleware]"

It gives the following output in the REPL:

; Jacking in...
; Connecting using "redsky Server + Client" project type.
; You can make Calva auto-select this.
;   - See https://calva.io/connect-sequences/
; 
; Starting Jack-in Terminal: pushd /home/zilti/projects/fossil/redsky ; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.0.0"},cider/cider-nrepl {:mvn/version,"0.28.5"}}}' -M:dev/deps:dev/env -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware shadow.cljs.devtools.server.nrepl/middleware]" ; popd
; Using host:port localhost:33727 ...
; Hooking up nREPL sessions ...
; Connected session: clj
; TIPS:
;   - You can edit the contents here. Use it as a REPL if you like.
;   - `alt+enter` evaluates the current top level form.
;   - `ctrl+enter` evaluates the current form.
;   - `alt+up` and `alt+down` traverse up and down the REPL command history
;      when the cursor is after the last contents at the prompt
;   - Clojure lines in stack traces are peekable and clickable.
; Evaluating code from settings: 'calva.autoEvaluateCode.onConnect.clj'
nil
clj꞉user꞉> 
clj꞉user꞉> 
; Creating cljs repl session...
; Connecting cljs repl: redsky Server + Client...
;   The Calva Connection Log might have more connection progress information.
; Starting cljs repl for: redsky Server + Client...
; Execution error (ExceptionInfo) at shadow.cljs.devtools.config/get-build! (config.clj:167).
no build with id: app
; Cljs builds started
; Execution error (ExceptionInfo) at shadow.cljs.devtools.server.nrepl-impl/repl-init (nrepl_impl.clj:30).
watch for build not running
; Error while connecting cljs REPL: TypeError: Cannot read properties of undefined (reading 'search')
; Jack-in done.
clj꞉user꞉> 
@PEZ PEZ added bug Something isn't working jack-in cljs ClojureScript-related configuration labels Jul 5, 2023
@bpringe bpringe changed the title jack-in not working with automation via settings.json deps.edn + shadow-cljs jack-in not working with automation via settings.json Jul 7, 2023
@PEZ
Copy link
Collaborator

PEZ commented Jul 14, 2023

I can reproduce this. Thanks for providing the info about it working without a defined custom sequence, but not with the sequence. Very strange, but probably a clue about where the bug lives...

@PEZ PEZ changed the title deps.edn + shadow-cljs jack-in not working with automation via settings.json deps.edn + shadow-cljs jack-in fails, when connect sequence builds are not keywords Jul 14, 2023
@PEZ PEZ mentioned this issue Jul 14, 2023
13 tasks
@PEZ
Copy link
Collaborator

PEZ commented Jul 14, 2023

The reason this happened is that we assumed the build names where entered as Clojure keywords. It's a bit undocumented that they need to be, but instead of updating the docs, I now keywordize the build names. In my testing this dev build works with your config file:

It would be great if you could confirm. 🙏

@zilti
Copy link
Author

zilti commented Jul 17, 2023

I can confirm that it works both with keywords (":app") and non-keywords ("app"), thank you! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cljs ClojureScript-related configuration jack-in
Projects
None yet
Development

No branches or pull requests

2 participants