This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-25
Channels
- # alda (7)
- # aleph (10)
- # announcements (3)
- # babashka (103)
- # beginners (54)
- # calva (62)
- # clerk (2)
- # clj-yaml (27)
- # cljs-dev (1)
- # clojure (61)
- # clojure-europe (64)
- # clojure-nl (3)
- # clojure-norway (34)
- # clojure-sweden (4)
- # clojure-uk (4)
- # conjure (9)
- # cursive (1)
- # data-science (3)
- # fulcro (20)
- # gratitude (1)
- # hyperfiddle (54)
- # lsp (9)
- # malli (7)
- # meander (4)
- # membrane (17)
- # off-topic (23)
- # releases (3)
- # sci (1)
- # shadow-cljs (5)
- # sql (1)
- # tree-sitter (8)
- # vim (6)
I just noticed that with something like:
(do
#_(prn 1)
(prn 2)
(prn 3)
)
pressing tab to reformat doesn't work. The #_
form prevents it for some reason.I can’t reproduce this. Is there something else in your file that might make this happen?
Apparently because the exmaple I gave you works fine here 😕
Now I can't find it or repro
Too bad. Would be great with something minimal like what you posted, but with whatever it takes to repro. Next time! 😃
I've had this happen before, but only when using CTRL+ALT+L in VSCode. It only happens if you comment code using #_
{
"key": "ctrl+alt+l",
"command": "calva-fmt.alignCurrentForm",
"when": "calva:keybindingsEnabled && editorTextFocus && !editorReadOnly && !hasOtherSuggestions && !suggestWidgetVisible && editorLangId == 'clojure'"
}
Heres the devtools error:
Hello, I think this may be an issue with Calva evaluating the file. See thread for more details…
Error:
; Execution error (NoSuchMethodError) at clj-yaml.core/make-yaml (core.clj:126).
; org.yaml.snakeyaml.representer.Representer: method <init>()V not found
Code that generates the error:
(defn ^:private load-yaml [fileName]
(-> fileName
(io/resource)
(slurp)
(yaml/parse-string)))
The (yaml/parse-string) generates the error
I’m using latest clj-commons/clj-yaml {:mvn/version "1.0.27"},
Version 1.0.26 works fine.
Runtime code works fine.
Its just in my VSCode that I see the error
Commands that I run in Calva: ctrl + alt + c, ctrl + alt + j (this starts the repl) ctrl + alt + c, then click enter, to evaluate file.
:require [ :as io]
[clj-yaml.core :as yaml]
Let me know if there is anything you need to reproduce.
Our clojure main, runs in our kubernetes DEV environment without issues.
Yes. I believe so. Just switching versions to 1.0.26 works.
Here is a partial stacktrace:
clj-yaml.core/make-yaml (core.clj:126)
clj-yaml.core/make-yaml (core.clj:102)
clojure.core/apply (core.clj:667)
clojure.core/apply (core.clj:662)
clj-yaml.core/parse-string (core.clj:301)
clj-yaml.core/parse-string (core.clj:263)
viasat.sdp.api.smoketests.config/load-yaml (config.clj:13)
I’m not setup to do that locally, I can try it tomorrow. But because the runtime works, I feel like it should probably work too.
How can Calva evaluate the file if you can’t do it from the command line? (I’m not very familiar with kubernetes.)
Pez, if you can give me the steps, I’ll do it. I went straight to Calva in working with Clojure. And I’m working with existing functionality.
Anyways, I was just letting you know in case you want to look at it. I can use the old version for now.
no its a deps.edn.
Don’t worry about it man. We can look into it next time
I thought it would be super easy for you to try it out, but looks like it might be kind of tough
Without Calva, I’m useless. The command line is impossible.
What’s the jack-in command line? (Calva has a command for copying the jack-in command line to the clipboard).
I can make a short video of what I’m doing if that will help
I think I get what you are doing from the description above. (I had just managed to forget that you used jack-in.) The jack-in command line will show us how to start the repl ourselves.
Ok, I started it on the command line, let me try to connect to it from Calva
Same error
To try to isolate the problem we should get Calva out of the test first. As well as nrepl. So if you paste the jack-in command line here, I will try to edit a command line that will start an interactive repl prompt in the terminal.
clojure -Sdeps ‘{:deps {nrepl/nrepl {:mvn/version,“1.0.0”},cider/cider-nrepl {:mvn/version,“0.28.5"}}}’ -M -m nrepl.cmdline --middleware “[cider.nrepl/cider-middleware]”
this ?
; Starting Jack-in Terminal: pushd /Users/kkamdar/repos/sdp-api/app/smoketests ; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.0.0"},cider/cider-nrepl {:mvn/version,"0.28.5"}}}' -M -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" ; popd
i can do that, but I haven’t been able to figure out how to load the file.
Googling around, its not clear
did that, let me try it again. I also tried (load-file).
kkamdar@C02G41SJML7L smoketests % clj
Clojure 1.11.1
user=> (requir(require 'viasat.sdp.api.smoketests.main)
nil
user=> (in-ns (in-ns viasat.sdp.api.smoketests.main)
Execution error (ClassCastException) at user/eval508 (REPL:1).
class java.lang.Class cannot be cast to class clojure.lang.Symbol (java.lang.Class is in module java.base of loader 'bootstrap'; clojure.lang.Symbol is in unnamed module of loader 'app')
user=>
let me try again using load-file
Clojure 1.11.1
user=> (load-f(load-file "src/main/clojure/viasat/sdp/api/smoketests/main.clj")
nil
user=> (in-ns (in-ns 'viasat.sdp.api.smoketests.main)
#object[clojure.lang.Namespace 0x5386cb4f "viasat.sdp.api.smoketests.main"]
viasat.sdp.api.smoketests.main=> (config/get-endpoints) (config/get-endpoints)
Execution error (IllegalArgumentException) at viasat.sdp.api.smoketests.config/load-yaml (config.clj:12).
Cannot open <nil> as a Reader.
viasat.sdp.api.smoketests.main=>
i know. I think the output is just messed up
Yeah. but you are also missing the quote on the namespace. That’s what the error message is about.
same error:
Clojure 1.11.1
user=> (load-f(load-file "src/main/clojure/viasat/sdp/api/smoketests/main.clj")
nil
user=> (in-ns (in-ns 'viasat.sdp.api.smoketests.main)
#object[clojure.lang.Namespace 0x5386cb4f "viasat.sdp.api.smoketests.main"]
viasat.sdp.api.smoketests.main=>
viasat.sdp.api.smoketests.main=> (config/get-endpoints) (config/get-endpoints)
Execution error (NoSuchMethodError) at clj-yaml.core/make-yaml (core.clj:126).
org.yaml.snakeyaml.representer.Representer: method <init>()V not found
But running it like this:
exec java $JAVA_OPTS \
-Dfile.encoding=UTF-8 \
-Dclojure.debug=false \
-jar /app/smoketests-standalone.jar
works. So maybe its not related to Calva
Yeah, since you get the error without Calva, it means this is not caused by nrepl or Calva.
But related to clj. I can try upgrading to a later version
Ok, thanks Pez, sorry for being a pest. Let me try to update the version
It could also be related to the clj-yaml version. Check in #C042XAQFCCU if someone has an idea what could be going on.
oh ok, let me check there, didn’t know there was a channel for it