This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-26
Channels
- # announcements (1)
- # asami (7)
- # aws (3)
- # babashka (30)
- # beginners (21)
- # calva (48)
- # cider (11)
- # clj-commons (5)
- # clj-kondo (12)
- # cljdoc (5)
- # cljfx (1)
- # cljs-dev (32)
- # cljsrn (4)
- # clojure (218)
- # clojure-europe (88)
- # clojure-nl (11)
- # clojure-uk (31)
- # clojurescript (8)
- # cursive (98)
- # data-science (6)
- # datomic (49)
- # emacs (12)
- # events (4)
- # fulcro (47)
- # graalvm (3)
- # graphql (4)
- # introduce-yourself (5)
- # java (13)
- # juxt (9)
- # lsp (74)
- # meander (3)
- # membrane (4)
- # missionary (31)
- # off-topic (24)
- # pathom (41)
- # portal (4)
- # reagent (3)
- # releases (1)
- # remote-jobs (3)
- # rewrite-clj (4)
- # shadow-cljs (10)
- # slack-help (2)
- # testing (20)
- # tools-deps (43)
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 https://github.com/juji-io/datalevin/issues/73 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
https://github.com/clojure-lsp/clojure-lsp/issues/703`transit` branch, that will fix all those weird errors, maybe it's worth wait for that
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!
@U07M2C8TT merged transit on master 🎉
Nice! I think that’s a nice simplification. I’ll update my branch.
Cool!
My branch parse-at-whitespace-or-comment
is updated (rebased and force pushed, in case you’ve already started testing it)
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.
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.
clojure-lsp has a lot of rules to suggest requires, like if you have a namespace foo.bar.baz
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
-> clojure.data.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
Code actions are pretty useful most of the time (and they are totally optional for user :D )
I created some :additional-snippets
for Clojure LSP in the following repo to complement the built in snippets. https://github.com/practicalli/clojure-lsp-config
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: https://practical.li/spacemacs/snippets/clojure-lsp/practicalli-snippets.html
Cool, IMO we could consider moving some of those to built-in snippets WDYT? I can test those later, thanks for that!
@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.
It won’t work right now, still trying to fix it. But I’ll also try with your config
@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 😉
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:
ah makes sense. I think thats a fix for you though, I haven’t looked into the clj-rewrite zipper stuff yet
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
@U02EMBDU2JU made a fix on master, could you try later please?
just built it, its working! 🚀
Good, @U05254DQM it should work for you too :)
now you just need to help me with the final little thing in the snippet PR to get it working for calva 😅
@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.
You can add to the top ns something like:
#_:clj-kondo/ignore
without changing your code, nothis is something I'd like to have to configure via clj-kondo, @U04V15CAJ is aware of that I think
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
@ericdallo did you intend to https://github.com/clojure-lsp/clojure-lsp/commit/a1caa57857e8ebb4fa5203d1c1723269cdddfa07?diff=unified#diff-73e59115160e9379d9b836354815087cbb8d2cb318635a6a53cd9a494330fad7R6-R24 most of the integration tests?
👌 That’s what I suspected.