Fork me on GitHub

I’m working in the clojure-lsp repo with a local build of the clojure-lsp executable. The cache never loads. The logs show “Could not load project cache from DB” and is being thrown. Anyone else seen this? Any thoughts on how to debug it? I’ve tried compiling with Java 8, 11 and 17. And I’ve tried running the b/compile-clj step with the --add-opens java opts mentioned in the attached Issue. I’m NOT on an M1 machine, FWIW. At worst I can just ignore it. It just means it’s really slow to restart the LSP server.


Oh, I also tried upgrading datalevin to 0.5.28


@U07M2C8TT that's odd, this happens when you use jdk17 and doesn't add the --add-opens


I use jdk11 most of the time


And we can't add --add-opens because it doesn't work with jdk8

ericdallo01:01:37`transit` branch, that will fix all those weird errors, maybe it's worth wait for that


maybe you can rebase your changes on transit for now


(and take the opportunity to help test that branch 😛)


Ah, OK, I’ll give that a shot. Thanks for the idea!


That does fix the caching. 🎉 I haven’t played with it much, but I will


The transit branch is a bit behind master. I had to merge master into it before I could rebase my changes onto it. I’ll refrain from pushing anything based on it so it isn’t merged prematurely. Having the cache working is helpful for debugging though. Thanks!


Nice, I intend to merge that branch soon this week


Merged master on transit meanwhile

👍 1

@U07M2C8TT merged transit on master 🎉


Nice! I think that’s a nice simplification. I’ll update my branch.


Yes, I saw lots of wins with that migration


Will work on graalvm migration now 🤞


My branch parse-at-whitespace-or-comment is updated (rebased and force pushed, in case you’ve already started testing it)


I intend to start testing tomorrow!


What do you think about calling clean-ns automatically after choosing any code action or refactor that changes a ns like Add missing require ? Considering adding that behind a flag enabled as default


I group my requires by purpose, so this would be very invasive for me. I would prefer it disabled by default. Thanks.


but this would work only for code actions that already add something to the ns, I'm afraid you don't use those ATM right? as it always add at the end of the ns already not matching your sort


If the code actions only add requires to the end, then it's not matching any sort, surely.

👍 1

Seems I'm more likely to use yasnippets to add a require (or clojure lsp snippets when they work in my setup). So it seems there no need to adopt the particular code actions that change the namespace form.


Hum, but if you type: str/split , clojure-lsp will show a Add missing clojure.string require, how you would do that with yasnippets automatically?


With Yasnippets, I wouldnt. I add a library within the ns form using the reqiure snippet, typing the name of that library and a meaningful alias. I would not like to used str as the alias for clojure.string either, but assume that is besides the point. I will have another look at this code action and see if its useful to adopt. I am curious as if there are specific alias names defined for libraries or if I can use a naming convention I prefer.


yeah, this was just a example, string/split would work as well :)


clojure-lsp has a lot of rules to suggest requires, like if you have a namespace and you type: bar.b/something it will suggest to require that namespace


besides some know alias that it suggests as well like io - > , edn -> etc


also, it checks if the alias was already imported anywhere in the project, which is pretty useful, suppose you have in some other namespace (:require [my.custom.ns :as bla]) if you type in other ns bla/something it will be available the code action Add missing my.custom-ns :as bla


I think this is one of my favorite features of whole clojure-lsp :)


Code actions are pretty useful most of the time (and they are totally optional for user :D )

Lukas Domagala15:01:38

yeah, I really love all the code actions. great work on those @ericdallo!

gratitude 1

I’d vote yes for a setting, enabled by default

👍 1
Noah Bogart12:01:13

I'm okay with that. I pretty much do that already

👍 1

I created some :additional-snippets for Clojure LSP in the following repo to complement the built in snippets. Unfortunately I cant get additional snippets to work in various setups yet, so appreciate any feedback on these. i.e. do they work okay. The snippets are also documented here:


Cool, IMO we could consider moving some of those to built-in snippets WDYT? I can test those later, thanks for that!

Lukas Domagala15:01:09

@U05254DQM what setup do you currently have? I’m working on fixing LSP snippets in Calva currently


Happy to have any of them included in the built-in snippets


@U02EMBDU2JU I've tried Doom Emacs and Spacemacs. Its been a while since I used Calva, but could do some testing with that too. I occasionally used Calva for the VS Code Live session sharing, so good to have snippets working there too.

Lukas Domagala15:01:26

It won’t work right now, still trying to fix it. But I’ll also try with your config

👍 1
Lukas Domagala01:01:14

@U05254DQM theres a bug in the customsnippets load code. Once that’s fixed your snippets will work in calva. Well once my calva fix PR is merged as well 😉

👍 1

The issue I found with addictional-snippets is that they doesn't work on top-level form, let me record to make it clear the understanding:

👍 1

The best would be to solve that

Lukas Domagala13:01:07

ah makes sense. I think thats a fix for you though, I haven’t looked into the clj-rewrite zipper stuff yet

Lukas Domagala13:01:27

and you are right, the additional snippets work in calva as well once I’m inside a list


yeah, the issue is that there are custom snippets that can use current-form variable, this one is mandatory to have a form


but all other ones should not require that


@U02EMBDU2JU made a fix on master, could you try later please?

Lukas Domagala13:01:11

sure, thanks for the quick bug fix, as always 🙂

👍 1
Lukas Domagala13:01:41

just built it, its working! 🚀


Good, @U05254DQM it should work for you too :)

Lukas Domagala13:01:38

now you just need to help me with the final little thing in the snippet PR to get it working for calva 😅


sure, I intend to start reviewing your and Jacob PR tonight

❤️ 1

@U02EMBDU2JU could you do a final rebase so I can try your PR and understand it why it's not working?


With the current Clojure LSP release the snippets are working within a (comment ,,,) form. I often write new code in a comment form anyway, especially when experimenting with data and function design. So I can use that approach until a new release of clojure-lsp comes out with the fix for top level snippets. Thanks.


Can we skip some specific file like user.clj file with clean-ns?


You can add to the top ns something like:

without changing your code, no


this is something I'd like to have to configure via clj-kondo, @U04V15CAJ is aware of that I think


A way to configure kondo linters for specific namespaces


indeed, there is an issue for it

👍 1

A similar question… what about a setting to format the range (or the whole buffer) after refactorings? Of course, ideally the refactorings would always generate well-formatted code.


yeah, the issue is that we have some performance issues with cljfmt ATM, that flag would need to be off by default for sure


Gotcha, makes sense


I usually do that to test a single integration-test


I should fix it soon


👌 That’s what I suspected.