Fork me on GitHub
#calva
<
2021-01-16
>
practicalli-john11:01:52

Does the output of running unit tests in Calva only show in the repl output window? I am sure I have seen a notification popup in the bottom right corner that shows test results? Was that Clover rather than Calva or did I miss a trick in configuring Calva?

pez17:01:06

It is only shown in the Output window. I don’t think we have ever shown it in some other way. Though @U0K592YDP once started a PR where the results where shown in the side bar. Today I think we would write a TestExplorer integration to achieve that.

Marc O'Morain18:01:32

The problem that I hit in my PR was the lack of docs for the cider / nREPL / clojure.tests integration.

Marc O'Morain18:01:57

It added the results to the Test Explorer pane.

👍 9
Joe15:01:25

It definitely does do that in Clover.

👍 3
agold16:01:49

With Calva 2.0.151, linter is flagging this: #_:clj-kondo/ignore (defrecord Slug [rowid src target supp lrd-from lrd-to nseen]) with the error Unused declaration: Slug clojure-lsp(unused-public) Slug is in fact used in the program via the conversion function ->Slug When I use the command-line clj-kondo --lint on this file, however, it lints OK with no errors. How do I suppress the error message in Calva?

borkdude16:01:50

Apparently that warning isn't coming from clj-kondo, but from clojure-lsp

agold16:01:40

How do I suppress it?

ericdallo16:01:40

Not sure we can disable that as probably is a bug in clojure-lsp

ericdallo16:01:49

But you can try setting linters :unused-namespace-declarations

agold16:01:14

Thanks, will try.

bringe19:01:35

@U2CR1J4UV Would you mind creating an issue in the clojure-lsp repo for this scenario?

bringe19:01:55

At least, I think @UKFSJSM38 would agree 😄

ericdallo19:01:37

Yeah, when @U0BUV7XSA finish the 100% clj-kondo integration, we could probably ignore that on clj-kondo level, but ATM it's clojure-lsp linter

👍 3
ericdallo19:01:58

BTW, did my suggestion above work @U2CR1J4UV?

borkdude19:01:30

Is there an option to disable the clojure-lsp linting via a config? They can always just enable the clj-kondo extension I guess

borkdude19:01:44

(I have a feeling I asked this earlier this week ;))

bringe19:01:05

Haha, no there is not. If this continues to be an issue I may add that

ericdallo19:01:05

It's a code that should be removed as soon we merge clj-kondo 100% integration so we should avoid improving it unless the merge takes too long

bringe19:01:23

I see, makes sense

borkdude19:01:25

Is there anything that is currently missing to accomplish this? Let me know

ericdallo19:01:34

I think there's nothing on clj-kondo side, @U0BUV7XSA it's WIP on this: https://github.com/clojure-lsp/clojure-lsp/pull/176

bringe19:01:51

Does kondo inform of unused publics? I remember that being a difference in it and what clojure-lsp offered. Like if I have (def x 1) in ns foo and it was not referenced anywhere in the code base, clojure-lsp would say unused public, but if it was referenced in ns bar it would not warn. And from what I remember kondo did not check references outside of the current file? Maybe I'm mistaken

ericdallo19:01:17

I think is something @U0BUV7XSA was working on clj-kondo, maybe @U04V15CAJ can tell us

borkdude20:01:06

@U9A1RLFNV clj-kondo doesn't do this by default, since it works with an open world view: it doesn't have a concept of "I now know everything about your project". But you can easily use clj-kondo's analysis output to do this. Here is an example: https://github.com/clj-kondo/clj-kondo/blob/master/analysis/README.md#unused-vars

borkdude20:01:11

The references outside the current file: it does have this concept, e.g. you get arity errors about vars in other namespaces.

borkdude20:01:33

There is an issue I'm working on right now to detect references that are unresolved in other namespaces. e.g. set/onion

bringe20:01:29

So clojure-lsp would need to keep providing at least these specific diagnostics if it wanted to keep them, right? If it stopped providing all diagnostics in favor of only kondo diagnostics, I think this specific case, at least, would be lost.

bringe20:01:37

CC @UKFSJSM38. Just hoping not to lose something 😄

ericdallo20:01:19

Yeah, the idea is not lose these diagnostics! we should use the kondo analysis to make that work

agold20:01:46

@UKFSJSM38 No, your suggestion didn’t work. I am using a workaround: (when nil (form that uses the supposedly undeclared thing))

ericdallo20:01:35

thanks, I'll check that later, open a issue on clojure-lsp could help to track that

agold14:01:45

@UKFSJSM38 I’ve just noticed that when clojure-lsp reports an unused declaration on a defn called in another file, closing and re-opening the file being edited will sometimes make the error disappear.

ericdallo15:01:05

Yes, I already saw that, I think the clj-kondo pr integration that we are working should fix that, otherwise I''ll take a look

ericdallo15:01:17

I hope we merge the PR this week

ericdallo17:01:40

@U2CR1J4UV just found the issue and it's a bug that always existed on clojure-lsp 😅 I opened this issue and hope fix it soon: https://github.com/clojure-lsp/clojure-lsp/issues/264

👍 3
practicalli-john17:01:29

Is there a reason Calva uses a single ; for comment lines? Or am I doing something wrong and comment lines do start with the usual ;; double semi-colon ? I didn't find a way to customise the line comment, except by hacking `.vscode > extensions >betterthantomorrow.calva-2.0.151 > clojure.tmLanguage.json

"repository": {
		"comment": {
			"begin": "(?<!\\\\);;",
			"beginCaptures": {
				"0": {
					"name": "punctuation.definition.comment.clojure"
				}
			},
			"end": "$",
			"name": "comment.line.semicolon.clojure"
		},

pez17:01:43

No particular reason except that if it starts with ;; it also starts with ;. I don’t think I quite follow when this is significant?

practicalli-john00:01:28

Oh, the standard practice has always been a double semi-colon for start of a line since I started with Clojure in 2010. I think this comes from lisp too, so it's even longer practice for lisp languages The Clojure style guidesl defines ;; as a comment line and ; as a comment after code on a line Formatting tools that follow the Clojure style guide will move singe ; comments half way along the screen. Cider does this too. So a developer using Calva may cause a lot of format changes for others developers they work with.

pez21:01:38

Calva formatting, which uses cljfmt, doesn't move comments at all. It's not clear to me how that causes formar changes.

practicalli-john09:01:38

Okay, sounds like you are happy doing comments differently

pez09:01:56

I think it is rather that we don’t understand how we are doing it differently. We don’t treat comments semantically. Which it seems you are expecting us to do?

practicalli-john20:01:29

Cider does. Cider will indent any single ; to half way in the page if it's a line comment. This will can cause friction between cider and Calva developers All the Clojure code I have worked with in the last decade always used double ;; for comments. It's one of the first things I remember learning about Clojure. I am quite surprised everyone doesn't know this

practicalli-john20:01:01

Code with single ; for comments just looks wired and feels very wrong to look at, even though semantic I appreciate some may think this trivial.

paulbutcher22:01:15

I’ve just noticed that I’m getting a clj-kondo warning saying that my -main function is an unused declaration. This certainly wasn’t happening a while ago, but I’m not sure when it did start. I’ve recently moved away from building with Leiningen and am now building with deps.edn which might be the cause? Or perhaps it’s something that’s changed within Calva? I’d welcome a nudge in the right direction.

borkdude22:01:15

this is probably not clj-kondo, but clojure-lsp saying this

paulbutcher22:01:17

Ah! Yes “Peek problem” says “clojure-lsp(unused-public)”

paulbutcher22:01:25

Nevertheless, it’s definitely new? Any idea why I’ve started getting the warning? And how to quieten it?

paulbutcher22:01:08

Thanks. And now that I know where to look, I can see that clojure-lsp was introduced into Calva last month, which explains why I’m getting the warning when I wasn’t before.

ericdallo22:01:18

Yes, good news is that we are working on that PR and we ll try to merge it ASAP 🙂 https://github.com/clojure-lsp/clojure-lsp/pull/261

👍 3