calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
Niclas 2021-03-31T08:41:54.159800Z

Hi, how would one enable Calva’s editor functionality in a file that doesn’t end with .clj /`.cljs` /`.cljc` ? In my case I’m working on a babashka script and think the file ending is irrelevant, but maybe I’m missing a bit of best practice here 😄

borkdude 2021-03-31T08:48:58.160100Z

@looveh I usually use .clj for bb scripts as well

👍 1
borkdude 2021-03-31T08:49:31.160900Z

Some people use .bb. Maybe Calva could activate Clojure mode for that as well

Tomas Brejla 2021-03-31T09:26:51.162600Z

You can manually change the editor mode using the control in bottom-right corned of the editor. By default it will be something like Plain Text . If you click that, you can change it to Clojure (just for this editor) or configure the mapping for your extension (if you use something like *.bb). But as borkdude said, it might be a good idea to use .clj.

borkdude 2021-03-31T09:26:54.163300Z

Is there a way to turn off the warning from Calva about running the clj-kondo extension separately? I mean, I know what I'm doing, kind of

pez 2021-03-31T10:01:44.165Z

@borkdude I don’t think that warning should show if you have configured Calva to not provide lsp linting. If you have configured it like that and still get a warning, I think that’s a bug. Please file an issue.

pez 2021-03-31T10:04:11.167100Z

@looveh, you can tell VS Code that it is a Clojure file. At the right side of the status bar there is a thing displaying the language ID. It is also a button. That said, what @borkdude said. And we should add .bb to the default extensions that gets treated as Clojure.

borkdude 2021-03-31T10:04:39.167700Z

@pez So Calva reads from my ~/.lsp/config.edn ?

borkdude 2021-03-31T10:05:07.167900Z

oh I see, it's a Calva config

pez 2021-03-31T10:12:25.168600Z

Yeah, a Calva config. It should probably be named a bit different, I now notice.

pez 2021-03-31T10:12:37.168900Z

Does it disable the warning for you?

Niclas 2021-03-31T10:12:46.169Z

Great, thanks!

ericdallo 2021-03-31T13:19:24.171Z

@pez @borkdude we now have a custom public clojure-lsp linter (unused-public-var), I think @borkdude will not get that linter disabling via Calva. I mean, now we can customize the linter only via .lsp/config.edn now, this way one could disable clj-kondo linter via there but use the public one from clojure-lsp still

ericdallo 2021-03-31T13:19:34.171100Z

c/c @brandon.ringe

pez 2021-03-31T16:05:02.173300Z

Dear Calva-friends. Can I get some help testing this fix to the command for running Current Test? ❤️ • VSIX: https://12412-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.184-1086-find-test-d6910e70.vsix • Issue addressed: https://github.com/BetterThanTomorrow/calva/issues/1086

bringe 2021-04-02T00:16:49.245400Z

Works well for me!

pez 2021-03-31T16:06:13.173500Z

Not sure I follow. Do we need to change something in Calva?

bringe 2021-03-31T16:49:28.173900Z

Calva's setting for disabling linting uses the diagnostics middleware, so it disables all

bringe 2021-03-31T16:49:57.174100Z

(We have an issue to also use initialization options for that, but that's beside the point here I think.)

bringe 2021-03-31T16:58:00.174400Z

FYI: Run Current Test on the with-test macro does not run the test with this vsix, but it does in current Calva.

(with-test
  (defn foo []
    #{{:id           1010101
       :display-name "Campaign 1010101"
       :state        "enabled"}})
  (is (= #{{:id 1010101
            :display-name "Campaign 1010101"
            :state "enabled"}}
         (foo))))

bringe 2021-03-31T17:01:22.174800Z

With the above and the vsix, I get the following output:

; Running test: defn…
; No tests found. 😱, ns: 0, vars: 0

bringe 2021-03-31T17:03:49.175Z

Added the above to the PR, maybe I should have just added it there to begin with :man-shrugging:.

borkdude 2021-03-31T17:07:01.175300Z

My primary "complaint" is just that I don't want to see the popup "Warning: you have clj-kondo installed", I will deal with the consequences myself

bringe 2021-03-31T17:14:42.175500Z

That should only show once for a user. Maybe it's not implemented that way, I need to check.

borkdude 2021-03-31T17:15:07.175800Z

It's showing every time I open VSCode

bringe 2021-03-31T17:15:32.176Z

Thanks. I'll look into it.

bringe 2021-03-31T17:18:16.176200Z

It might actually be good to remove it now. Issue and question for @pez here: https://github.com/BetterThanTomorrow/calva/issues/1091

ericdallo 2021-03-31T17:39:17.176600Z

Yes, I understand how calva does that ATM, my suggestion is just to rely on clojure-lsp config for that, because imagine some user wants to use a external clj-kondo linter but still wants to use the custom clojure-lsp linter at the same time

bringe 2021-03-31T17:47:39.176800Z

I see. Our reasoning for the Calva setting is that a user who installs Calva should be able to disable linting from Calva, because they might not yet know what clojure-lsp or clj-kondo are, and they shouldn't have to know if they just want to disable all linting (a user brought this up to us and it made sense). I think leaving the Calva setting, but maybe clarifying it would be good, like: "Show [all] linter warnings and other diagnostics"

bringe 2021-03-31T17:48:28.177Z

Actually currently, by default, they can configure each tool independently if they want, AFAIK.

bringe 2021-03-31T17:49:13.177200Z

So long as you want Calva to show diagnostics, you would leave that checked, as it is by default, and configure clj-kondo and clojure-lsp as you see fit.

ericdallo 2021-03-31T17:51:50.177400Z

yes, I agree that a Calva setting is the perfect for the final user, my point is that every config on .lsp/config.edn can be configured via initializationOptions as well, so my suggestion is to have a calva setting where user could select what linters it should use from clojure-lsp. As of now we have 2, clojure-lsp unused-public-var and clj-kondo linter, https://clojure-lsp.github.io/clojure-lsp/settings/#diagnostics-linter. Otherwise that calva setting is disabling both linters, and users like @borkdude would not be able to use both clojure-lsp custom linter and external clj-kondo linter only via Calva setting, but manually changing clojure-lsp config

ericdallo 2021-03-31T17:52:03.177700Z

But is just a suggestion 😅

borkdude 2021-03-31T18:02:03.178100Z

The only thing I asked for is to not have the popup about uninstall clj-kondo all the time. The rest I can deal with

ericdallo 2021-03-31T18:02:53.178300Z

yes, I know, is just that your question made me think about this possible case

borkdude 2021-03-31T18:03:15.178500Z

I do want to see additional linters from clojure-lsp

borkdude 2021-03-31T18:04:01.178700Z

in the lsp config I can do this right?

:linters {:clj-kondo {:level :off}
           :unused-public-var {:level :warning}}

borkdude 2021-03-31T18:04:17.178900Z

doesn't this take care of it all?

ericdallo 2021-03-31T18:05:13.179100Z

yes, that's my point, user needs to know that this config exists and need to know about the third party lib that calva uses

borkdude 2021-03-31T18:05:30.179300Z

yes

ericdallo 2021-03-31T18:05:32.179500Z

my suggestion is that the user could just change calva settings that would do that easily

ericdallo 2021-03-31T18:06:07.179700Z

but like I said, is just a suggestion, not a priority it seems 😅

borkdude 2021-03-31T18:06:26.179900Z

> so my suggestion is to have a calva setting where user could select what linters it should use from clojure-lsp I don't understand. I think clojure-lsp should be configured in one place, not Calva and some other place

ericdallo 2021-03-31T18:07:54.180200Z

clojure-lsp can be configured via a file .lsp/config.edn and via initializationOptions passed from the LSP client when starting the server

ericdallo 2021-03-31T18:09:06.180400Z

from a final user point of view, I just want to configure it via my editor friendly Calva setting, not needing to know another lib that Calva uses that I need to change

borkdude 2021-03-31T18:09:12.180600Z

isn't it better to prefer the .lsp/config.edn file so team members have to just configure it once and not in their own editors?

borkdude 2021-03-31T18:09:22.180800Z

oh I disagree then :)

ericdallo 2021-03-31T18:09:31.181Z

yeah, it depends on the use case

ericdallo 2021-03-31T18:09:45.181200Z

for teams, yes, for single users no

borkdude 2021-03-31T18:10:33.181500Z

I still disagree though. Just write the docs one time and it works for all editors

borkdude 2021-03-31T18:10:42.181700Z

Editing a .edn file is easy, no fancy UI needed

borkdude 2021-03-31T18:11:13.181900Z

I don't want my config spread in some weird VSCode directory

borkdude 2021-03-31T18:11:22.182100Z

or .emacs.d

borkdude 2021-03-31T18:11:32.182300Z

I want to do it once and use it from both editors

ericdallo 2021-03-31T18:11:58.182500Z

yes, I agree it has benefits, I just think this is something that I like on VSCode, handle things for me. Maybe Calva could change the .lsp/config.edn

ericdallo 2021-03-31T18:12:06.182700Z

just like clojure-lsp now changes .clj-kondo/config.edn

ericdallo 2021-03-31T18:12:14.182900Z

it'd be the best of the options maybe

borkdude 2021-03-31T18:12:16.183100Z

yeah, that would be better I think

pez 2021-03-31T18:20:26.185600Z

Users are encouraged to share vs code settings via vcs though. That is not where the distinction cuts.

pez 2021-03-31T18:33:57.186Z

Both works! 😂

alpox 2021-03-31T18:56:20.190Z

Hi all, I'm a little confused what happens in my setup especially regarding intellisense. I took the fulcro template and adjusted it a little so I can jack-in with deps.edn . This starts also the shadow-cljs part through:

:watch {:main-opts ["-m" "shadow.cljs.devtools.cli"
                               "watch" ":main"]} 
Now if I connect my repl to the shadow-cljs build through Connect to a Running REPL Server in the Project everything works (I have the repl etc.) but intellisense only works for the clj files. I also wonder how I can switch between those two REPL connections as it now only switches whenever I evaluate something in either a clj or cljs file. Is there a command I don't know about?

pez 2021-03-31T19:38:46.190300Z

@brandon.ringe, the want to disable lint diagnostics surely must be quite uncommon. What if we just have that in our documentation that it can be configured via the lsp configs?

👍 1
borkdude 2021-03-31T19:39:17.190600Z

I agree

ericdallo 2021-03-31T19:39:34.190800Z

the time it was implemented that setting on Calva, clojure-lsp didn't have that option, now I think it make sense 🙂

pez 2021-03-31T19:40:04.191Z

Agree we can remove the warning that bugs @borkdude entirely now. Anyone who get the problem with double linting will have to find our docs. Which are not really hidden.

👍 2
bringe 2021-03-31T19:48:11.191400Z

> What if we just have that in our documentation that it can be configured via the lsp configs? Adding something to the docs pointing people to the lsp config I think makes sense, but I see no reason to remove the Calva setting. By default all linting is enabled and anyone can configure things as they see fit with the tools' configs.

bringe 2021-03-31T19:49:03.191700Z

If you want to disable all linting without wanting to know what those tools are, you can uncheck the setting

pez 2021-03-31T19:50:14.191900Z

It’s a setting too many in my book.

bringe 2021-03-31T19:50:17.192100Z

What I mean is, I see no problem here that needs to be fixed, aside from maybe pointing out the lsp config file in the docs and/or linking to the clojure-lsp docs. Maybe I misunderstand though. Btw, I'll remove that kondo warning.

pez 2021-03-31T19:52:10.192300Z

I think the setting mostly causes confusion. Should I disable it here or here? What are the implications of the possible combinations? Etcetera.

bringe 2021-03-31T19:52:24.192500Z

I thought we discussed and agreed to this, along with the user who requested the setting in the past :thinking_face:. But, if you want to remove it now, we can. It might put us right back to someone else saying "how do I disable linting? Oh, I have to know this other tool is used by Calva and configure it even though I don't want linting? How do I configure that?" I don't know the best thing here though.

bringe 2021-03-31T19:53:24.192700Z

We may just need to remove it and point people to clojure-lsp docs when they ask. I just haven't really seen any confusion from users about the setting.

pez 2021-03-31T19:54:07.193Z

This thread is confusion. 😃

bringe 2021-03-31T19:54:56.193200Z

I thought you might say that, lol

pez 2021-03-31T19:55:14.193400Z

I think we are talking about 0.001% of the users crazy enough to want to disable linting help.

bringe 2021-03-31T19:56:11.193600Z

Agreed

bringe 2021-03-31T19:56:14.193800Z

Removing is simpler, anyway

bringe 2021-03-31T19:56:31.194Z

https://github.com/BetterThanTomorrow/calva/pull/981 Here's the discussion fyi, but I'm leaning on removal.

pez 2021-03-31T19:56:42.194300Z

As I am adding an lsp setting the sum of zero is nice. 😃

pez 2021-03-31T19:59:27.194600Z

Reread the discussion super sloppy, but I think one of the things there are about that it was a clj-kondo setting. Now it will be a clojure-lsp setting, right? So more direct.

bringe 2021-03-31T19:59:48.194800Z

Yes, things are different now than when we made that change

pez 2021-03-31T20:01:45.195Z

It will not be the first time we have threshed a bit. 😃

pez 2021-03-31T20:02:04.195200Z

Prolly not the last either. Haha.

😄 1
bringe 2021-03-31T20:05:08.195500Z

Made an issue to remove it. Hooray for removing things! 🎉 😄

3
pez 2021-03-31T20:09:50.195800Z

That setting didn’t spark joy!

😂 1
pez 2021-03-31T20:18:07.197Z

@alpox You might need to add some option there to let shadow know it should load cider dependencies.

alpox 2021-03-31T20:20:25.198Z

@pez thanks for the response! That sounds like a rabbit hole I didn't touch yet 😄

pez 2021-03-31T20:21:27.198800Z

> I also wonder how I can switch between those two REPL connections Is this regarding the REPL window? There’s a command named Toggle the REPL Connection (clj or cljs) used for CLJC Files (also a button in the status bar).

pez 2021-03-31T20:22:08.200Z

If you jack-in using shadow-cljs project type you’ll see the option used there for injecting cider dependencies.

alpox 2021-03-31T20:22:24.200700Z

The Toggle the REPL Connection changes from shadow-cljs' clj server to the shadow-cljs cljs connection while the server started from deps.edn is not touched however many times I toggle

alpox 2021-03-31T20:24:11.202900Z

> If you jack-in using shadow-cljs project type you’ll see the option used there for injecting cider dependencies. Where would these options appear? I'm still a bit green behind the ears with these options

pez 2021-03-31T20:24:21.203100Z

I am not sure it works having a deps clj w/ a shadow-cljs cljs session. It used to work, but might have been broken…

pez 2021-03-31T20:25:15.204100Z

In the terminal pane you can select the jack-in terminal where the jack-in command is executed.

alpox 2021-03-31T20:26:27.204300Z

alpox 2021-03-31T20:26:48.205Z

Thats all I see there - it all starts fine and works, just the switch between the sessions doesn't work, and the cljs intellisense

alpox 2021-03-31T20:27:02.205600Z

If thats not intended to be working I guess i'll have to take that 🙂

pez 2021-03-31T20:28:28.206800Z

I wouldn’t say it is not intended, but you are out on a bit of uncharted territory. 😃

pez 2021-03-31T20:30:31.207900Z

But for intellisense to work in cljs, shadow needs to know cider is requested. So those main-opts need to specify that, I think.

pez 2021-03-31T20:31:06.208800Z

And if you jack-in selecting the shadow-cljs repl type you will see what options might be needed.

alpox 2021-03-31T20:31:25.209100Z

Ah, ok thanks, I'll do some research on that (Even though I have no idea how these things hang together) maybe I'll find something 🙂

pez 2021-03-31T20:33:33.211200Z

I know people are using Calva with Fulcro + shadow-cljs fullstack. Maybe we can get help from someone in the know about that.

alpox 2021-03-31T20:40:38.214100Z

There must be something else off on my side :thinking_face: I started only the shadow-cljs build alone which also uses the cider argument but intellisense doesn't even show up there

pez 2021-03-31T20:42:15.214600Z

Can you evaluate cljs things through the repl?

alpox 2021-03-31T20:44:44.215100Z

Yes, I also tried (js/alert "foo") just to go sure its connected to an instance

alpox 2021-03-31T20:48:28.217500Z

Well, I guess I'll try this for some more time at the weekend, I don't want to steal much of your time for what could stay a toy-project

pez 2021-03-31T20:48:30.217600Z

Two strange things there: 1. you don’t get cider-nrepl lookup help even though the repl is started with those options 2. clojure-lsp doesn’t give you lookup help.

pez 2021-03-31T20:50:19.219100Z

If you can make the project public, I can have a look and see if I can figure it out.

alpox 2021-03-31T20:50:34.219500Z

Oh the intellisense while typing and with ctrl-space works. The hover hints do not :thinking_face:

pez 2021-03-31T20:51:55.221100Z

So completion works. Hmmm.

alpox 2021-03-31T20:52:12.221400Z

The project is currently pretty much just the fulcro template (Im in the planning phase) but I can upload it to github if you'd like. Its really not something mission-critical though.

pez 2021-03-31T20:53:22.222400Z

I’ll have a look tomorrow. I’m curious now.

pez 2021-03-31T20:53:24.222600Z

😃

alpox 2021-03-31T21:04:25.222900Z

Alright 🙂 https://github.com/alpox/fulcro-test here you go and thanks for looking into this! 🙂

1
borkdude 2021-03-31T21:05:32.223600Z

I am trying to push a new version of clj-kondo, including the vscode plugin, but I'm getting:

Cannot GET /api/releases/stable
when executing vsce. Does this sound familiar to anyone?

borkdude 2021-03-31T21:07:24.224Z

should I update this part?

"engines": {
    "vscode": "^1.33.0"
  },
@pez @brandon.ringe?

pez 2021-03-31T21:15:26.225200Z

I don't remember seeing this. Maybe they have some server side issue right now?

borkdude 2021-03-31T21:22:06.225400Z

This is the entire log: https://gist.github.com/borkdude/5cd0e78877fc5cb69eae37b4687419bd

borkdude 2021-03-31T21:22:17.225700Z

It's pretty annoying since I'm in the middle of a clj-kondo release

borkdude 2021-03-31T21:25:21.226Z

I commented out vscode-install which was the non-working step I think

borkdude 2021-03-31T21:25:30.226300Z

and just published without this, not sure if that works, but we'll see

borkdude 2021-03-31T21:43:43.226800Z

I don't even know why that was part of the package.json, I just removed it and it seemed to work

borkdude 2021-03-31T21:53:50.226900Z

bringe 2021-03-31T22:16:52.227600Z

Weird. I have not seen that before either. It does seem like a server issue.