Fork me on GitHub

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?


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

It definitely does do that in Clover.

👍 3

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?


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


How do I suppress it?


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


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


Thanks, will try.


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


At least, I think @UKFSJSM38 would agree 😄


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

BTW, did my suggestion above work @U2CR1J4UV?


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


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


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


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


I see, makes sense


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


I think there's nothing on clj-kondo side, @U0BUV7XSA it's WIP on this:


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


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


@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:


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


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


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.


CC @UKFSJSM38. Just hoping not to lose something 😄


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


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


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


@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.


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


I hope we merge the PR this week


@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:

👍 3

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"


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


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.


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


Okay, sounds like you are happy doing comments differently


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?


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


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.


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.


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


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


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


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.


Yes, good news is that we are working on that PR and we ll try to merge it ASAP 🙂

👍 3