Fork me on GitHub
#calva
<
2019-09-10
>
iha201:09:10

I’m having a hard time getting calva to have go to definition working.

iha201:09:22

Anyone have any idea what in the world I need to do?

hoppy02:09:19

@iha2 - assume you have a repl jacked-in?

iha203:09:32

Yup, I even have the whole file evaluated as my research says would be appropriate

hoppy03:09:53

I haven't worked calva for awhile. assume we are talking clojure (and not script) here?

hoppy03:09:10

evaling a file and getting the namespace right seem to be two crucial points.

iha203:09:14

it’s clojurescript actually

hoppy03:09:57

I'm a little rusty, but it doesn't look (with current versions) to be doing what I expect either

iha203:09:36

I’ve been trying for a few days now

hoppy03:09:40

let @pez wake up. it's actually pretty good

hoppy03:09:13

we went through a lot of this a few months back, and it was a pretty clean deal.

hoppy03:09:21

what is your build tool for the cljs

hoppy03:09:02

and, node or browser?

iha203:09:31

and shadow-cljs is my build tool

hoppy03:09:55

that was sort of the chosen path, so it should be viable.

hoppy03:09:10

I had a mess of some node code that I moved to shadow.

iha203:09:32

It was a good move?

hoppy03:09:06

yes. prior to shadow, things where quite the mess. My stuff came before all of that was really online, so it was ugly.

hoppy03:09:21

much happier with shadow for that project.

hoppy03:09:56

I'm not sure I had a good specimen of a browser only project with shadow though

iha203:09:56

It works pretty well. My problems with clojure/script have always been the build tools.

iha203:09:22

I’m such a fan of lisps but the tooling is sucking energy lol

hoppy03:09:22

Its a complex animal.

iha203:09:44

Thank you for responding by the way.

iha203:09:53

I’ll go to bed and wait for pez.

hoppy03:09:04

you must be in my timezone ~

iha203:09:56

or at least close

iha203:09:01

11:46 here

hoppy03:09:15

your eastern

hoppy03:09:47

I'm ~ houston

hoppy03:09:24

yeah, I loaded my clj/cljs/cljc "full stack" thingmo, and I'm having the same thing you are talking about. Something changed, that used to work

hoppy03:09:45

you are talking about just F-12'ing on a function call?

iha203:09:43

Yeah just doing that tells me it fails.

hoppy03:09:53

same here.

hoppy03:09:11

about all I have to offer is that it is probably a regression. It used to work.

iha203:09:26

At least it’s more than me.

iha203:09:42

That’s helpful enough 🙂

hoppy03:09:24

kk, I'll go back and sit in the emacs soup. I'm so ancient I'm able to deal with it.

😂 4
hoppy03:09:44

I'm unsavable. emacs is wired to my cerebral cortex since the early 80's

iha203:09:58

calva was supposed to be my salvation from cider nrepl-refactor failing me

iha203:09:34

As long as it works for you, stick with it.

hoppy03:09:34

I want to see vscode/calva succeede. It isn't quite there yet, but it has good people behind it. In a couple of years, that will be the one true way IMHO.

hoppy03:09:20

mostly want to see clojure succeede, and you can't lead with "learn emacs"

gerred03:09:23

what's not there yet?

gerred03:09:27

i'm super happy with calva.

gerred03:09:44

oh, go to definition

gerred03:09:01

yeah at the moment both autocomplete and definitions aren't working in shadow-cljs for me

gerred03:09:08

i didn't notice until this convo 🙂

hoppy04:09:40

Love calva, expect it to be the "one true way" before much longer.

hoppy04:09:08

right now cider/emacs has it beat, for me, in terms of handling back-channel stdout

hoppy04:09:38

that, and I'm a geezer, and emacs has become an implant.

hoppy04:09:47

I really try not to let that bias affect me.

hoppy04:09:33

emacs is pretty byzantine, but a lot of what calva suffers is because of VS-code design choices. For example, ^X52 is something I do all day in emacs, and VScode doesn't have a comparable story

pez06:09:58

Good morning, Calva friends. 😃

8
pez06:09:00

So, I can jump to definitions in my shadow project (which is Calva). Let me try with a browser project...

Teemu Kaukoranta06:09:05

Hey, I'm trying to switch from Cursive to Calva. Previously I would start a lein repl and do a remote connection to it from Cursive. For CLJS I'd use yarn shadow-cljs watch app. When I "jacked-in" Calva, I chose shadow-cljs, and for the cljs build, I chose app again. The CLJ repl seems to work, but the CLJS repl says that no application is connected to the REPL server. I think this is more related to shadow-cljs, but can anyone point me in the right direction?

Teemu Kaukoranta06:09:24

tbh I think I'm not using shadow in the best way possible

Teemu Kaukoranta06:09:35

ah I got it working now. I just forgot to start the jetty server. 😅

aw_yeah 4
pez06:09:16

Nice. Is it a browser project?

Teemu Kaukoranta06:09:49

yeah, reagent web app

pez06:09:28

So, just checking, after you have evaluated a cljs file, can you jump to definitions and see docs on hover?

Teemu Kaukoranta06:09:30

I've used leiningen+figwheel previously. I feel like we just replaced figwheel with shadow, so we're probably not using shadow to its full potential

Teemu Kaukoranta06:09:20

yeah, seems to work

pez06:09:34

Interesting. Which version of shadow-cljs?

pez06:09:11

(It doesn’t work for some people, it has just been reported, and when I try with a browser project, it doesn’t work either. Unless I run the dev version of Calva, which doesn’t seem to have the problem… But neither are you…

pez06:09:17

Stick to that a while, then is my advice. 😃 Until we have figured out if it is latest version of shadow that throws things off.

pez06:09:35

So, it wouldn’t work with navigating to definitions for me either, using a browser target, @gerred, @hoppy, @iha2. It looks like something has moved in shadow-cljs actually. Because if I use this prerelease version it works: https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.35-wip-custom-repl-connect-sequence (the reason that would work might be that the prerelease specifies the piggieback version it uses, and maybe latest shadow is using something there that Calva doesn’t like…) Please try with that prerelease VSIX and let me know if it works. If so, I’ll cut a release (though I had planned on testing this a bit more before releasing, but there is little point with that if it is better than the currently released one)..

iha212:09:28

It worked! Thank you!

gerred12:09:14

oh yes, I downloaded that from clojureverse and then forgot to install it

pez12:09:11

Cool. I've published a new version on the Marketplace, which is almost the same (+ a bug fix) as the prerelease. So you can upgrade from there now. So happy I had a solution in the stove. I do wonder what changed in shadow...

pez12:09:16

One thing about shadow jack-in. It is a bit different from Figwheel in that it doesn't give me any obvious hooks to follow the process. So with Figwheel the connection sequence is much more ... hmm what's the word ... well, held together. The most visible difference with shadow Calva indicates it is connected even before the cljs app is started. Anyway, in the Terminal jack-in pane, you'll find the link to the webapp. Saves you typing. 😃

gerred16:09:06

@pez oh yeah, I should've let you know, it was good for me.

alekszelark07:09:39

Hi! Recently I started using Calva, and I’m happy with that. However, in our project we use 2-space indentation for function (macro) arguments while Calva follows the community Clojure Style Guide, so it uses 1-space indentation for the same case. I wonder is there some way to customize that? The doc says “[Calva gives] you some options to tweak this style”, but I didn’t find them except calva.fmt.* ones, and those didn’t help. Maybe I did it wrong. Can someone help me?

pez07:09:31

Those calva.fmt.* once are the only tweaks Calva offers atm. There was a thread about this yesterday, I’ll tag you in there, @zelark.

pez07:09:24

Oh, it was in the #vscode channel. I invited you there. 😃

Sasho11:09:05

Hello 🙂 Wouldn’t it be cool, if there was a shortcut directly in Calva, which calls a form, that is, it wraps a from in () and evaluates the whole thing. I think there could be a separate shortcut for this, so that after we define a function, we can directly call it. Here’s an example:

(defn hello
  []
  "hello")
If we place the cursor right after the end of the form and press the shortcut for evaluation, we’d get something like: #'some-namespace.core/hello. However, if we press the shortcut for calling the form, we’d get "hello". That would save writing on a newline (hello) and evaluating it.

metal 4
pez11:09:02

I like it. Please file as feature request!

pez11:09:14

(Though, it would probably rather be *Call Current Top-level form*, since you probably have the cursor inside the form, and even if you have it right after, it would still do the right thing.

pez11:09:05

And.. would only work for zero args…

Sasho17:09:04

Yeah, to be honest, the main use-case for me would be evaluating tests, defined with deftest without needing to write tne name of the test on a new line and evaluating it:

(deftest foo ...)

(foo)

kstehn11:09:57

or when you know there are args you just ask the user to filled it?

pez11:09:34

Yeah, I think it’ll take some analysis of the form. I also think nREPL can help with that.

pez14:09:55

And since it also fixes a problem with jacking in to latest shadow-cljs, we decided to release it. We are still very keen on feedback, of course.

gerred16:09:39

you know what would be handy (I'll open an issue)

metal 4
gerred16:09:05

a quick re-jack-in so I can restart a process without having to kill the task, etc., if I'm bringing in a new dependency

metal 4
Travis16:09:54

Out of curiosity has anyone created a shareable key-mapping that mimics emacs key bindings for CIDER ?

pez16:09:19

@gerred: That sounds pretty cool. I don’t know how to do it, actually, but sure it should be possible.

pez16:09:12

If you create more bindings, or change them, please update that page.

Travis16:09:33

thnx!

❤️ 4
gerred17:09:45

this is interesting and might be really nice too: https://github.com/rksm/clj-suitable

dominicm17:09:38

it's baked into cider now

gerred17:09:07

OH NICE, that's great

gerred17:09:03

it looks like the calva cider npepl isn't on ~0.22.0 which is when it was introduced

gerred17:09:18

I ran shadow-cljs manually with the newer dep but no dice inside of calva, so I imagine there's more to it than just updating the dep 😉

kstehn17:09:54

i just tested this with upgrading the version in calva it seems to be fine

gerred17:09:24

could be PEBKAC on my end

gerred17:09:42

when I: npx shadow-cljs -d cider/piggieback:0.4.1 -d cider/cider-nrepl:0.21.1 watch :app it works, when I change that cider-nrepl version it does not.

gerred17:09:48

(when I connect as opposed to jack in)

gerred18:09:08

checking now

gerred18:09:24

i promise to also at some point soon add some contributions. 😄

gerred18:09:15

totally works

gerred18:09:38

now I just need shadow-cljs npm interop completion and this is just 🔥🔥

gerred18:09:39

thank you!

kstehn18:09:14

nice calva is kinda wierd with its dependencies 😅

gerred18:09:52

one more vexing thing that might be more of a shadow-cljs reality 🙂

gerred18:09:06

calva's reporting 0 tests when trying to run both individual and all tests (though it's 1 test) for shadow-cljs connected to a profile

gerred18:09:15

of course, when I enable-console-print! it shows the test run in my console. 😄

gerred18:09:49

it's not too bad

gerred18:09:51

but it'd be nice to not have to alt tab to see my test runs

gerred18:09:13

(when i'm iterating on something that I could just do purely from the repl)

kstehn18:09:11

mhm iam not sure how testing works so i cant even guess where the problem is could you post an issue with this

gerred18:09:56

yeah! no problem.

gerred18:09:35

oddly, I managed to do some combination of things that got it to actually report to the output and make calva happy....and then never managed to do it again 😅

pez18:09:15

Thanks! I haven’t tried the test runner with shadow-cljs even. I wrote the test runner parts early on, before I realized there were cljs tests. With shadow I just have :autorun true.

gerred18:09:46

yeah I think making a test build of course works, because it's generating out a js file.

gerred18:09:20

and this does work, I just need to keep a js console handy 😉

pez18:09:09

About suitable. Yes it is sweet. The reason we have not updated is that we had this big jack-in thing cooking, and suitable is a bit unstable. So to not introduce two sources of error at once…

gerred18:09:20

oh totally fair

gerred18:09:37

it does say something though when this is all nice to haves. 😉

pez18:09:54

When using :autorun true the test results are reported in the jack-in terminal.

gerred18:09:23

are you adding that key to any build during jack-in?

gerred18:09:27

or do I need to add that to my build?

pez18:09:45

I think it could be a Good First Issue:tm: , @gerred, to add an opt out for new cider-nrepl versions. Just sayn’

gerred18:09:14

I'd be up for that, though why would a person opt out? 😉

pez18:09:34

I start the :test build at jack-in.

gerred18:09:48

ah ha. I'm doing this with my :app build and evaluating/running individual tests as I go.

pez18:09:09

Haha, yeah, why would you opt out? 😃 I think that with cider-nrepl it is pretty safe to follow the latest version. But sometimes… haha. Anyway. I’d like for Calva to follow the latest, and make it easy for the user to notch it back a step. Or something. We should probably discuss it some.

gerred18:09:36

could make it overridable with whatever is in: deps.edn or shadow-cljs.edn

pez18:09:15

I’d rather not. I’m sort of on a mission to rid deps.edn of editor dependencies.

gerred18:09:34

ah, insulate calva from the project?

gerred18:09:56

maybe a vscode setting then (that you could set per workspace)

kstehn18:09:36

i would follow as closely as possible to cider-nrepl version as possible otherwise it could be harder to migrate from older versions

pez18:09:18

Yes, more like that. Maybe a very nice opt-in. “There is a new cider-nrepl, which adds X, Y and Z. Want to use that instead of old boring current version?”

pez18:09:58

@slack1038, yeah, it makes sense to follow the tip. It is just that in this case I happen to know there are issues. Then what makes sense changes, I’d say. 😃

kstehn18:09:34

mhm okay i merged it to dev hope this is okay 😅

pez19:09:32

Let’s see what @gerred experiences 😃

gerred19:09:10

so far working nicely

gerred19:09:33

TIL about ctrl-i 😍

pez19:09:18

Is it any good? I’ve been figuring about wether to keep it.

gerred19:09:27

I love it.

gerred19:09:35

I didn't want to give up having the style guide indentation for installing parinfer.

gerred19:09:54

I can always cmd-] or cmd-[ but having it all in one command... 👍

gerred19:09:05

(with the ctrl-shift-p)

gerred19:09:24

er, ctrl-alt-p

gerred19:09:27

paredit + just the right sprinkling of parinfer

gerred19:09:37

am I crazy for thinking there was a strict mode for parens?

gerred19:09:25

i could've sworn I saw it at some point in some setting but can't find it now