Fork me on GitHub
#calva
<
2023-07-28
>
rpatrelle09:07:27

Hi, I am new to Calva coming from Intellij/Cursive. First steps are really promising. But I am facing an issue blocking my move. My project is a deps project in a polylith structure. I start the repl via Calva Jack-In integration. The repl starts well. But when I load my code, I am facing this error:

; Syntax error (FileNotFoundException) compiling at (dev/core.clj:1:1).
; Could not locate portal/api__init.class, portal/api.clj or portal/api.cljc on classpath.
; Evaluation of file romain.clj failed: class clojure.lang.Compiler$CompilerException   
In my deps.edn file, Portal dependency is declared in a debugger alias (I removed most of all dependencies for easy reading purpose):
:aliases {:dev {:extra-paths ["development/src"]
                :extra-deps {better-cond/better-cond {:mvn/version "2.1.5"}}}

          :debugger {:extra-deps {com.github.jpmonettas/flow-storm-dbg {:mvn/version "3.3.303"}
                                  criterium/criterium {:mvn/version "0.4.5"}
                                  djblue/portal {:mvn/version "0.37.0"}}}
          :cider-nrepl {:extra-deps {cider/cider-nrepl {:mvn/version "0.29.0"}}
                        :main-opts ["-m" "nrepl.cmdline"
                                    "--middleware" "[cider.nrepl/cider-middleware]"]}}
I tried to put Portal dependency in my ~/.clojure/deps.edn in the extra-deps and it solves my issue:
:deps {
          djblue/portal {:mvn/version "0.37.0"}
   }
My question is: How can I specify to Jack-in to load the :debugger alias ? I am not so happy to have to put in my profile deps.edn dependencies of tool all the team is using and declared in the project deps.edn. Is there a way to configure Jack-in or is it mandatory in that case to start a repl in command line?

pez10:07:51

When jacking in, Calva should prompt you about launch aliases. Doesn’t it?

rpatrelle12:07:07

When Jacking in, Calva request: • the root folder • then the project type And launch without any question regarding aliases

rpatrelle12:07:34

I found a settings.json file in .vscode folder where there is this configuration:

{
  "calva.replConnectSequences": [
    {
      "projectType": "deps.edn",
      "name": "local",
      "cljsType": "none",
      "menuSelections": {
        "cljAliases": ["dev", "test"]
      }
    },
    {
      "projectType": "deps.edn",
      "name": "stage",
      "cljsType": "none",
      "menuSelections": {
        "cljAliases": ["dev", "test"]
      },
      "jackInEnv": {
        "ENVIRONMENT": "stage",
        "AWS_PROFILE": "stage"
      }
    },
    {
      "projectType": "deps.edn",
      "name": "iago",
      "cljsType": "none",
      "menuSelections": {
        "cljAliases": ["dev", "test"]
      },
      "jackInEnv": {
        "ENVIRONMENT": "iago",
        "AWS_PROFILE": "iago"
      }
    },
    {
      "projectType": "deps.edn",
      "name": "production",
      "cljsType": "none",
      "menuSelections": {
        "cljAliases": ["dev", "test"]
      },
      "jackInEnv": {
        "ENVIRONMENT": "production",
        "AWS_PROFILE": "production"
      }
    }
  ]
}
Can modifying it by hand solve my issue? (does I risk side effects?)

rpatrelle12:07:19

Sounds it works to modify this file.

pez12:07:12

Yeah. If you are using one of those, it will skip the launch aliases menu.

rpatrelle12:07:50

So maybe somebody in my team created this file but did not update to take into account debugger alias. Many thanks for your help.

seancorfield17:07:01

@U01BZRQA0ER You say "when [I] load my code" it complains about Portal being missing -- your code depends directly on Portal? Or did you do something else that involved Portal?

rpatrelle17:07:41

Second proposal: we have a dev namespace where is stored command allowing to start portal and other stuff like development stuart sierra component atom...

seancorfield18:07:32

That's what we do at work with Polylith and Calva/CIDER etc.

seancorfield18:07:47

We have the following config in the repo:

"calva.replConnectSequences": [
    {
      "name": "World Singles Backend (Jack-In)",
      "projectType": "deps.edn",
      "cljsType": "none",
      "autoSelectForJackIn": true,
      "projectRootPath": ["/var/www/worldsingles"],
      "menuSelections": {
        "cljAliases": ["build", "dev", "+default", "test", "vscode-calva-jack-in"]
      }
    },
    {
      "name": "World Singles Backend (Connect)",
      "projectType": "deps.edn",
      "cljsType": "none",
      "autoSelectForConnect": true,
      "projectRootPath": ["/var/www/worldsingles"]
    }
and the vscode-calva-jack-in alias is:
:vscode-calva-jack-in
  {:extra-deps {com.datomic/dev.datafy {:git/sha "4a9dffb"
                                        :git/tag "v0.1"
                                        :git/url ""}
                djblue/portal {:mvn/version "0.44.0"}
                io.github.seancorfield/dot-clojure
                {:git/tag "v1.0.2"
                 :git/sha "6a3f903"}
                io.github.stuarthalloway/reflector
                {:git/sha "93a0c19b4526c1180959e940202928d35e5c3cef"}
                jedi-time/jedi-time {:mvn/version "RELEASE"}
                party.donut/dbxray {:mvn/version "RELEASE"}}
   :main-opts ["-e" "((requiring-resolve 'org.corfield.dev.repl/start-repl))"]}

12:07:43

hi @U04V70XH6, thanks a lot for sharing your configuration.

Dustin Getz14:07:31

Has anyone worked out what keybindings to set to make alt-backspace in Calva match MacOS, as well as navigate forward/back by word based on grammar context (i.e. inside a string), and whatever other similar commands

pez15:07:04

What does “match macOS” mean?

Dustin Getz15:07:26

I don't know, I'd have to work it out, hoping someone else already has