vscode-code-runner icon indicating copy to clipboard operation
vscode-code-runner copied to clipboard

Running Clojure

Open Hlidskjalf opened this issue 7 years ago • 5 comments

The default to run Clojure is lein exec and should be cd $dir && lein run

Hlidskjalf avatar May 16 '18 17:05 Hlidskjalf

What the difference of lein exec and lein run?

formulahendry avatar Jun 03 '18 12:06 formulahendry

lein exec fails in VS code, lein-exec is a third party extension, but lein run in the correct directory runs the currently open file as you'd expect.

Hlidskjalf avatar Jun 03 '18 13:06 Hlidskjalf

Quick fix is to add

"code-runner.executorMap": {
  "clojure": "lein run"
}

to your user or workspace settings

enzosv avatar Oct 17 '18 04:10 enzosv

Quick fix is to add

"code-runner.executorMap": {
  "clojure": "lein run"
}

to your user or workspace settings

thanks for this workaround, but now leiningen complains about: no :main namespace specified in project.clj any idea there?

Hamido-san avatar Feb 22 '21 22:02 Hamido-san

so I finally found a "working" workaround by hooking up the official clj/clojure tooling instead of leiningen, like this:

"code-runner.executorMap": {
  "clojure": "powershell -command clojure -M \"$fullFileName\""
}

and it works like a charm now, well a charm that takes 2 seconds to load every single time, but still … in fact if you don't want to wait 2 seconds every time, you can use babashka instead:

"code-runner.executorMap": {
  "clojure": "bb"
}

Hamido-san avatar Feb 25 '21 06:02 Hamido-san