This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-11
Channels
- # announcements (16)
- # aws (17)
- # babashka (25)
- # beginners (60)
- # calva (40)
- # cider (3)
- # clara (4)
- # clj-kondo (24)
- # clojure (16)
- # clojure-austin (3)
- # clojure-dev (23)
- # clojure-europe (33)
- # clojure-nl (2)
- # clojure-norway (7)
- # clojure-uk (4)
- # clojurescript (39)
- # clr (108)
- # conjure (10)
- # cursive (12)
- # datalevin (7)
- # editors (2)
- # events (1)
- # fulcro (24)
- # graalvm (3)
- # introduce-yourself (8)
- # london-clojurians (2)
- # malli (18)
- # meander (6)
- # missionary (10)
- # nbb (16)
- # off-topic (19)
- # polylith (1)
- # portal (4)
- # rdf (1)
- # reitit (4)
- # remote-jobs (3)
- # shadow-cljs (10)
- # xtdb (12)
Does anyone know why calva doesn't resolve vars in :required
namespaces(sometimes) when I try to load a namespace and all dependencies?
It works if I first load the dependency ns manually
I don't think I've seen this happen. If you can provide a repro that would be awesome.
Going to try and repro it and make an issue, it happens sometimes and I don't know why yet.
• It doesn't appear after restarting the repl (which I don't want to do)
• I load namespace foo
which requires bar
. foo/calculate
is a function which uses a def: bar/currencies
.
I get the error: bar/currencies no such var
> It doesn't appear after restarting the repl
Checking... If you restart the repl and then load foo
, it works? Then you do some stuff and try to re-load foo
, and the error happens?
correct
I have seen this numerous times too, but no idea yet what is the repro case. For now, I just manually eval the other ns and move on.
It sounds more like a REPL issue than a Calva one to me. Next time it happens, try do something like lein repl :connect
and require foo
with :reload
. Would be interesting to know if that works.
> try do something like lein repl :connect
>
I don't use Lein, so not really sure what you're asking for here.
I see this too sometimes and also just eval the other namespace(s) and move on. Not sure what causes it but it does seem like it’s an issue with nrepl since Calva just delegates to nrepl for loading from what I know. If we can nail down a repro that would be great.
>> try do something like lein repl :connect
> I don't use Lein, so not really sure what you're asking for here.
Sorry. I meant connect with another nrepl client.
An equivalent tools-deps command line is:
clojure -Sdeps '{:deps {reply/reply {:mvn/version "0.5.1"}}}' -M -m reply.main --attach `< .nrepl-port
`
I've been using calva on my luminus project with the Server + Client option, and it works great. In my current setup I have clojure installed locally, but I'd like to move to a docker development environment. It seems that if I connect vs code to a docker container, and install calva in that container, than i can continue to use calva the same way as I've been doing up until now. However, when I try connecting vs code to a docker container, my computer seems to be working really hard. I'd like to try to instead run an nrepl server in the docker container, and connect calva to that running server. Is there a way that I can do this which will imitate the Server + Client experience, or will I have two run to separate nrepl servers, and have two vs code windows open?
Hi! I think you should be able to set it up so that you run the nrepl server in the docker container and connect using the existing Server + Client
connect sequence It can be a bit finicky (I am fighting this very battle today myself in a Luminus based project.). Findings so far:
• Make sure the nrepl server is bound to 0.0.0.0
.
• Use a hard coded repl port
• Forward the nrepl port to the host machine.
◦ If you are using a volume for the project, forward to same port number on the host, so that the nrepl-port file will contain the truth for Calva to find.
• Probably more that I am forgetting right now. 😃
Hi @U0ETXRFEW, nice to hear there's someone else out there currently dealing with the same thing. What command did you run inside the container, just 'lein repl' or something more? I should also mention that I'm using shadow-cljs. I don't know if this makes a difference, I am pretty new to clojure
I use the same command as when starting it locally. If you use the command Calva: Copy Jack-in command line to clipboard and select the Server + Client sequence you will get the command.
nice looks like that'll be a big help. thanks again
and calva is absolutely amazing
love it
absolutely
the repl is now working after following your instructions. however there is no interaction with the browser. how can i fix this?
maybe i'm missing another port binding?
yep that was it, after binding port 9630 it's working like a charm
I see this as one of the biggest advantages of Calva compared to other Clojure IDEs. In this space VS Code + Calva is maybe even the only real option. (Emacs + TRAMP or SSH + tmux + Emacs is not the same) From my limited trials I have as well the impressions that Calva + VS Code has all needed features, it just need to be documented in a more prominent place and with several scenarios. I have as well the scenario of "docker on a remote sever", which works as well but is a but is even more finicky. Additionally I see the scenario of "windows Laptop with only VS Code" + "remote docker on Linux server" as potentially interesting for some people.
i'm finding that the 'go to definition' command in vs code is not working now that i'm using docker. is there a way i can fix this?
to be clear, it's not working for imported libraries
my mistake, it seems that it's not working for anything brought in from another file
solved https://stackoverflow.com/questions/37341849/vscode-go-to-definition-not-working
@U049ALBMH4K how did you solve it?
As I understand the problem: The REPL is running in the container and have different paths to the files than you have locally. When the REPL responds with a path to file, VS Code doesn't find it there. Seems Calva (or maybe nREPL) would need to support some kind of mapping.
This is what I thought the problem is as well. i'm really not sure how to solve it
@U0ETXRFEW have you had a positive experience using the vs code 'attach to running container' feature?
it seems to be going pretty smoothly. it froze up my computer a bit at first but now it seems to be working
also, the 'go to definition' works fine with my clojure project when vs code is not connected to a repl. would it be possible to make a setting which allows the 'go to definition' feature to function independantly of the connection to the repl?
> have you had a positive experience using the vs code 'attach to running container' feature? I think it has been a bit painful. In the app I am working with I've now instead put the infrastructure it uses in a docker-compose system but run the Clojure REPL locally.
> would it be possible to make a setting which allows the 'go to definition' feature to function independantly of the connection to the repl?
There is such a setting, actually. Search for ”calva definition priority” (or something like that) in the settings. Set it to prioritize lsp over repl. Usually it is better with repl definitions (e.g. for .cljc
files), but a lying repl is another thing...
great! thanks
@U7CAHM72M @U049ALBMH4K If either of you wanted to submit PRs for documenting this Docker stuff better in the Calva docs that would be great. I don’t use Calva with Docker so I’m not familiar with it. I’m not sure if that info should be added to https://calva.io/remote-development or if what you’re doing is different from that.