This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-14
Channels
- # adventofcode (38)
- # announcements (42)
- # aws (3)
- # babashka (8)
- # beginners (165)
- # calva (36)
- # chlorine-clover (14)
- # cider (6)
- # clj-kondo (5)
- # cljsrn (33)
- # clojure (27)
- # clojure-australia (1)
- # clojure-czech (1)
- # clojure-doc (1)
- # clojure-europe (26)
- # clojure-nl (6)
- # clojure-spec (6)
- # clojure-uk (3)
- # clojurescript (10)
- # code-reviews (20)
- # conjure (1)
- # core-logic (5)
- # cursive (3)
- # data-science (5)
- # datomic (35)
- # emacs (1)
- # figwheel-main (3)
- # fulcro (10)
- # honeysql (1)
- # introduce-yourself (4)
- # jobs (3)
- # jobs-discuss (4)
- # minecraft (2)
- # missionary (28)
- # nextjournal (3)
- # off-topic (45)
- # pathom (7)
- # polylith (1)
- # portal (22)
- # practicalli (2)
- # re-frame (4)
- # reagent (19)
- # releases (3)
- # remote-jobs (3)
- # reveal (1)
- # rum (4)
- # shadow-cljs (37)
- # spacemacs (14)
- # sql (1)
- # tools-build (7)
- # tools-deps (16)
- # vim (13)
- # xtdb (15)
Is there some way to get stack traces working with Calva and shadow-cljs? I can do something really basic like this:
(defn greeting-for
[name]
{:pre [(string? name)]}
(str "Hello " name))
(greeting-for 123)
But all I get in my output.calva-repl
is just #object[Error Error: Assert failed: (string? name)]
-- no mention of the name of the function that failed. That's obviously less than helpful, especially beyond a trivial example like this. Is there some way to fix this to show the function name or full stack trace?I’m not sure, but I wonder what a terminal repl would show in this case. With the shadow-cljs watch process running, you can run shadow-cljs cljs-repl <build-id>
and then run (greeting-for 123)
there and see what kind of output you get. You may need to run (in-ns '<namespace-of-that-function>)
first, or use the fully qualified symbol for it.
Looks like if I do in at the terminal REPL I get the same thing: #object[Error Error: Assert failed: (string? name)]
, no additional information.
This might just be the nature of ClojureScript. I’m not sure if a stack trace can be gathered from the repl in that case or not. The #object
part is due to JavaScript.
You could try asking for more info in #shadow-cljs or #clojurescript. I’d suggest using the terminal repl as your case, rather than using Calva, so no one thinks it’s something related to Calva.
Yep, sounds like that's the case. Will try asking in other channels, thanks!
Does anyone here ever use Go to Definition
with Java symbols? I don’t think I’ve ever had this work from Clojure, but apparently it is possible with nrepl/cider-nrepl/orchard. If anyone knows how to make it work, please post information on this thread: https://github.com/BetterThanTomorrow/calva/issues/1436.
Recently I started to use code actions accessible via Ctrl+.
Namely Add require
is a handy thing sometimes. For example it offers me a Add require '[clojure.string :as str]
, when I use str/join
in my code.
This alone works nicely, the require gets added to my ns defition. But I still have to manually jump to the ns
defition and re-evaluate that ns form in order to be able to use that require in my REPL session. It's logical that I have to do it, it's just a bit annoying to jump to the top of the file and then back again.
Do you use this feature? And if so, do you have any trick in your sleeve to somehow automate this?
For now I can think of these two:
• cmd+up
, alt+enter
, ctrl+-
(on mac, this will go to the start of the file, evaluate the current form, and then go to wherever you were.)
• Load the file (is not always an option, I know)
I also really like that feature. I use cmd+opt+c enter to reaload the file when I use it (like pez mentioned in the second bullet)
I was just reading that I can Command-Click on a stack frame to goto the source. This is great! But the source file shows up in the same editor group as the REPL. The REPL is in a different editor group. It’s usually source on the right and REPL on the left so I get the source file in the left and the right. Is there some way to not open a new source file on command click? release: 2.0.231
There isn’t, unfortunately. VS Code lacks the APIs to support it. It’s one of the oldest requests on the API I know of which is this generally important, but never seem to really move: https://github.com/microsoft/vscode/issues/15178
Got it. And I’m happy to have the stack traces even with a double open file. Thanks for the reply!
Anyone else having issues with Go to Definition
? Broke down today, can't figure out a fix. Tried rolling back a few versions, didn't help.
I saw, @UKFSJSM38 mention, somewhere, that some fix for something else caused something like this. Not sure if related.
So that’s for external deps. Is that what you are experiencing, @UDRFLNJUV?
Not quite, in my case even definitions from the same folder are not found.
sounds like a wrong project configuration for clojure-lsp, could you print the output of command Calva diagnostics: clojure-lsp server info
?
Or, it could be the REPL that is in some funny state. Check if works when not connected.
I didn't change any project settings recently, so it's probably some broken state. How can I reset it?
Yeah, I tried rolling back to fix the issue. Here's output from the last version.
is it possible to create a sample repro? I can't see why all go to definitions couldn't work
Not sure how to reproduce it. Tried deleting .lsp, using different versions of Calva, the issue persists on Windows. But it does work on Linux, so the problem is not in Calva.
I'm out of ideas on how to fix this. Any suggestions?
so if the issue is only for windows, we need to check if it's not working for all cases or something specific, could you create a simple repro repo where the issue happens so we can debug it better?
I'll try.