Fork me on GitHub
#calva
<
2021-11-30
>
jarppe12:11:17

What could be the problem when Calva does not show any exceptions? I can eval statements and the results are shown in repl window, but if the evaluation causes an exception, nothing is shown anywhere?

jarppe12:11:48

For example, I can evaluate (ex-info "Oh no" {}) and the repl windows pretty prints it just fine, and the evaluation result is printed next to the form

jarppe12:11:13

But if I evaluate (throw (ex-info "Oh no" {})) absolutely nothing happens.

jarppe12:11:07

It is still evaluated, it’s just that the exception goes … somewhere

jarppe12:11:33

(try (throw (ex-info "Oh no" {})) (catch Throwable e (println e))) evaluates to nil and repl shows the exception

Tomas Brejla13:11:59

@U0GE2JPNC you might want to open developer console in VSCode (`Help/Toggle Developer Tools` ). Maybe you'll find some exception in there.

pez13:11:44

What kind of project is this? How do you start it?

jarppe13:11:11

I start the clojure process with nREPL first, then Connect to Running REPL…

jarppe13:11:57

But this happens also when I tried with babashka and Start a REPL project and Jack-in

jarppe13:11:48

Hmmm…. tried with fresh project and Start REPL and exceptions are shown normally

jarppe13:11:38

So there must be something in my projects that causes this. What could it be?

jarppe14:11:33

@U01LFP3LA6P I get this kind of messages, but they seem to come all the time, not when eval causes an exception

Tomas Brejla14:11:42

are you using anything debugging-related in calva?

pez14:11:06

There are no interesting message at the terminal where you started the REPL?

jarppe18:11:37

No, I don’t thinks so:

This is the Calva evaluation results output window.
; TIPS: The keyboard shortcut `ctrl+alt+c o` shows and focuses this window
;   when connected to a REPL session.
; Please see  for more info.
; Happy coding! ♥️

; Connecting ...
; 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 'afterCLJReplJackInCode'
(require 'user)
nil
clj꞉user꞉> 

pez18:11:12

Oh, I meant the shell where you started the repl.

bringe02:12:11

@U0GE2JPNC It looks like the repl you’re connected to does not include cider-nrepl middeware (judging by that debugger message in the dev console). I’m not sure if that’s causing your issue with exceptions though, but it’s worth looking into.

John Born04:12:27

I think I had this happen to me a few days ago. IIRC, I fixed it for myself by starting the repl through the jack-in command (rather than connecting to it and starting in a separate terminal shell).

jarppe05:12:08

@U9A1RLFNV Ok, that narrows it down, thank you. It has worked for me, but I guess I have changed classpath so that cider-nrepl is now missing. I’ll look into this.

jarppe05:12:50

@U021JR5PY3B That would be the best way, I’m sure. Unfortunately that’s not an easy to achieve for me, I have a setup where everything, including my service with nrepl, is started by docker-compose.

bringe05:12:25

You can copy the command for jack-in by using the Calva command (search the command palette for “copy jack-in”) and paste it somewhere to see what Calva injects. You can either start your project repl in a similar way (with docker-compose, I guess), or you can modify your project file / configuration to include the dependencies.

jarppe05:12:12

Thankyou!!!

jarppe05:12:38

I did that “copy jack-in to clipboard” thing (which by the way is just amazing think), but I now remember that at some point I read from nREPL docs that the --middleware argument is not required anymore

jarppe05:12:44

…and I remved it

jarppe05:12:04

everything seemed to work just fine, until much later I noticed this exception thing

jarppe05:12:35

I added the "--middleware" "[cider.nrepl/cider-middleware]" back to my deps.edn and now it works again

Tomas Brejla17:11:12

Hello. I know it's possible to navigate to source code of some library that I have in my :deps of my project by either ctrl-clicking the namespace symbol or using Go to Definition (`F12`) command on it. But in order to do that, I need to have the name of such namespace somewhere in my editor. Is it possible to open source of any 3rd party library's namespace without having to type the ns to my editor? Or perhaps see all the .clj/cljc/cljs files that my project transitively use?

bringe02:12:44

I’m not sure if there’s a way, but Calva does not provide a way that I know of. Maybe there could be something with lein/clj that helps with this, but I don’t know that you would be able to easily read the results or navigate to the files.

Tomas Brejla09:12:14

the definition probably gets opened via clojure-lsp, right? So generic "open namespace by name" or "list namespaces" features would probably need to be implemented in there first.. (?)

bringe19:12:39

When a repl is connected, definitions are opened via Calva (maybe with nrepl/cider-nrepl help). When the repl is not connected, definitions are opened via clojure-lsp.

bringe19:12:26

There’s a feature request here for being able to navigate to namespaces by name: https://github.com/BetterThanTomorrow/calva/issues/545. It’s somewhat related, but not really what you originally requested.

Tomas Brejla19:12:09

actually that seems like a very nice feature to have and is pretty much what I originally had in mind. Something like "open namespace/symbol" with modal window offering fuzzy search functionality and then opening the source the same way as F12 does.

👍 1