Fork me on GitHub
#lsp
<
2021-06-06
>
Mitja10:06:14

https://twitter.com/borkdude/status/1388193273630576640 you can navigate to re-frames sub and events. Is this something that could work with Calva as well? As far as I understand it is using both clojure-lsp and clj-kondo, so in theory it should, but I wasn't able to get it to work. One thing I noticed is that @borkdude is using namespaced event names in the linked tweet, is that necessary for this to work? I also checked the PR that adds support for this for clj-kondo and from the https://github.com/clj-kondo/clj-kondo/pull/1266/files#diff-f591b825c81f488c7fa9426a07ba9dd30f948cc52e445be929d5fd8299bc7ddeR1646 you have to import the re-frame's functions directly from re-frame? So using you own wrappers around these functions would probably not work?

borkdude10:06:38

@mitja.bezensek Correct, you have to use the re-frame functions

borkdude10:06:00

But you can always do find-references on any keyword

Mitja10:06:49

yeah, that's what I'm using right now just quickly tried to replace references so that I used re-frame.core ones but it's still not working will try to start an new project to rule out issues with our configuration

Mitja11:06:06

created a new project using lein new re-frame lsp-test +kondo this template uses re-frame functions directly and also uses namespaced events / subs, but I'm still not able to get it to work

borkdude11:06:26

did you create a .clj-kondo directory in the root of the project?

Mitja11:06:54

yeah, it's there

borkdude11:06:39

is there also a sqlite db in your .lsp dir?

Mitja11:06:02

yes there is

borkdude11:06:38

ok I will try locally

borkdude11:06:16

I see the issue. It works after I visit the events.cljs namespace.

borkdude11:06:33

The reason for this is probably that there is no deps.edn or project.clj in this project

borkdude11:06:41

And so lsp doesn't know what files to scan

Mitja11:06:27

for me it doesn't work after visiting that namespace go to definition for other function does work though

borkdude11:06:00

for me it did work

borkdude11:06:14

I recommend moving your deps to deps.edn for now

borkdude11:06:22

and tell shadow to look for the deps over there

Mitja12:06:26

couldn't get it to work. might be just me incorrectly setting things up though 😅 do you have an example repo where it should work?

borkdude12:06:42

I just followed your lein new command

borkdude12:06:15

To reproduce again:

lein new re-frame lsp-test +kondo
cd lsp-test
echo '{}' > deps.edn
Then start editing your code in this new project. Navigation to the re-frame event works immediately

Mitja13:06:34

must be something else, this does not work for me

borkdude13:06:39

I bet it's an LSP config issue. Are you in emacs?

Mitja13:06:14

vscode + calva

Mitja13:06:22

this is the clojure-lsp server info

borkdude13:06:43

I'll defer you to @UKFSJSM38 or @U0ETXRFEW now because I can only speak for clj-kondo and/or emacs.

👍 3
Mitja13:06:21

thanks for help! hopefully we can figure it out 🙂

Mitja13:06:38

I see that clj-kondos version is 2021.04.23, could that be an issue?

borkdude13:06:32

it seems you still have an old lsp server

Mitja13:06:59

updated both, no luck unfortunately

Mitja13:06:13

will see if @UKFSJSM38 or @U0ETXRFEW might know more, thanks again!

Mitja13:06:46

hm, I did update clj-kondo and clojure-lsp via scoop but seems like calva is still using the older versions here's the server info after the update

Mitja13:06:54

looking into how to update it

pez13:06:34

Calva uses its own clojure-lsp, there is a Calva setting for selecting which version it should download.

Mitja13:06:06

WORKS!

🎉 3
Mitja13:06:36

based on your suggestion I added this to vscode's settings.jsons "calva.clojureLspVersion": "2021.06.01-16.19.44",

Mitja13:06:59

thanks to both of you!

❤️ 6
borkdude13:06:11

@U0ETXRFEW why was Calva using an old one

borkdude13:06:35

Question mark (ffing phone)

pez13:06:49

We haven’t bumped the version since a while. Maybe we should have a settings for following latest, @U9A1RLFNV?

ericdallo15:06:32

Looks a good idea @U0ETXRFEW

bringe18:06:23

@mitja.bezensek By the way, there is a command in Calva to get just the server info. I'm not sure if you were using that or not. Calva Diagnostics: Clojure-lsp Server Info.

👍 6
bringe18:06:33

@U0ETXRFEW @UKFSJSM38 Do you mean adding a setting that would allow the user to opt-in to Calva always using the latest clojure-lsp version? I'm not sure if that's a good idea, or at the very least, it should default to not automatically using the latest version. Sometimes (though hopefully not often), things may not work well between Calva and the latest clojure-lsp - but if the auto update is opt-in, maybe this is not that big of a deal - the user decides they want this risk for the benefit of always using the latest clojure-lsp. The version setting serves this purpose, but just makes it more of a manual opt-in process. I think right now I'm in favor of keeping it this way, but I'll update the default version used by Calva to the latest.

borkdude18:06:38

I'd say Calva could include something in its build to update clojure-lsp to the latest before release. Being a couple of releases behind seems like a bad default.

ericdallo18:06:31

Yeah, or maybe make it clearer for users that they have outdated clojure-lsp

pez19:06:04

I think that the current scheme assumes that we Calva devs “vet” the clojure-lsp versions and decide when they work well enough with Calva to be included as default. But in reality we don’t have this capacity. We bump the clojure-lsp version more based on exciting new features. 😃

pez19:06:52

And only if we happen to pick up on the news of such features.

bringe19:06:10

> I think that the current scheme assumes that we Calva devs “vet” the clojure-lsp versions and decide when they work well enough with Calva to be included as default. Yes, though admittedly we don't vet every feature. Maybe we just make sure it starts up fine and a few things work.

pez19:06:18

Anyway, we don’t need to make latest the default. But giving the users that options seems cool to me.

pez19:06:59

And, really, the root problem here is making it more obvious that Calva is using its own clojure-lsp. I’ve seen quite a few trouble shooting reports, including @mitja.bezensek’s above, where brew (or the equivalent) is tried.

borkdude19:06:46

Is Calva using another version of clojure-lsp, on top of what the user chooses to use?

pez19:06:01

Not easy at all… Maybe we should have a clojure-lsp status bar button side by side with the nREPL one? Then we can have tool tips and menus and stuff.

borkdude19:06:05

I think it would be time-saving for all of us if the user knows they're not using the latest lsp/kondo somehow

bringe19:06:45

This sort of relates to using libraries in a project though, I feel. Would you always want your build tool to install the latest version of your deps when you build your project? I would think not for the sake of determinism. But, of course, this is a bit different.

pez19:06:46

It’s not wether they use latest. It is that they are using something Calva maintains.

bringe19:06:20

But either way I do agree we need to make it more clear that Calva is not using their installed version of clojure-lsp

bringe19:06:37

Unless they use the path setting to make Calva use it

pez19:06:40

@U9A1RLFNV I am fully ready to not make latestthe default. I’m just suggesting making it an option.

borkdude19:06:53

Calva should probably explicitly print these versions in the welcome message if it doesn't already do so

bringe19:06:06

I get that, I was more directing that toward @borkdude. Just curious on his thoughts there.

pez19:06:16

I don’t think anyone reads those welcome messages.

pez19:06:56

Or, anyone, is not right. But most people don’t.

borkdude19:06:06

at least you can ask them to copy-paste what it says there in case of an issue like this. that would have saved me time today ;)

pez19:06:34

Ah, that’s of course very nice to be able to ask for.

bringe19:06:46

Well that's what the server info command is for, and that's documented 😄

ericdallo19:06:09

That was my point, just some window with basic info of clojure-lsp/calva version so most issues we just ask the info from that window

ericdallo19:06:26

Yeah, maybe the server command is good enough

ericdallo19:06:32

We just need to ask that first

pez19:06:35

The welcome message is probably very good for this.

ericdallo19:06:42

Maybe add to the issue template as well

metal 3
bringe19:06:50

We can put it in the welcome output window message too

👍 6
metal 3
pez19:06:43

We will prove @U051BLM8F wrong when he says you can’t decomplect using documentation. 😃

borkdude19:06:21

Instead of "did you try turning it off and on again" we can say: "please post your welcome message"

☝️ 3
borkdude19:06:07

or we can even write a bot for it! 😼

😄 3
pez19:06:20

copying … wait, this says … you know what guys? I solved it myself. 😃

😄 6
bringe19:06:50

Calva v2.0.200 is out now, which uses the latest clojure-lsp. I also added a note near the top of the clojure-lsp doc about Calva determining the version by default, the server info command, and how to change the version used. Also added that Calva does not use the version of clojure-lsp installed, unless it was set to do so. https://calva.io/clojure-lsp/

🎉 12
aw_yeah 3
nice 6
bringe20:06:02

I'll leave the updating of the welcome message up to @U0ETXRFEW

Mitja09:06:11

@U9A1RLFNV yes, I used the Server info command to get those logs and it led me towards finding the solution

👍 2