This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-26
Channels
- # announcements (1)
- # aws (6)
- # babashka (1)
- # beginners (109)
- # calva (22)
- # clj-kondo (21)
- # cljsrn (1)
- # clojure (68)
- # clojure-europe (41)
- # clojure-nl (2)
- # clojure-uk (5)
- # clojurescript (7)
- # core-logic (1)
- # data-science (4)
- # datomic (1)
- # events (1)
- # fulcro (25)
- # gratitude (1)
- # juxt (4)
- # keyboards (1)
- # malli (5)
- # minecraft (3)
- # missionary (9)
- # music (1)
- # nextjournal (7)
- # off-topic (7)
- # polylith (31)
- # re-frame (3)
- # reveal (7)
- # ring (11)
- # shadow-cljs (1)
- # spacemacs (4)
- # tools-build (5)
- # tools-deps (5)
- # xtdb (25)
Not sure which channel I should post this, but I’m guessing people in this channel have experienced and solved the issue I’m having. In my polylith repo clojure-lsp (via Calva) doesn’t seem to work properly. New files don’t get the (ns …)
form, references are not found until the target files are opened in the editor, things like that. I found https://github.com/clojure-lsp/clojure-lsp/issues/416 and https://github.com/clojure-lsp/clojure-lsp/pull/445, which suggest that this should work. I tried creating a .lsp/config.edn
at top level to see if that helps, but that didn’t seem to make a difference. What am I missing? Thanks!!!
I’m mentioning @U0ETXRFEW in case he has an idea about this
Thanks! I think this is mostly a question for @UKFSJSM38 (who probably, like me, has already been alerted to it 😃). It might very well lead to requests on Calva, we had a similar discussion in another thread. (And I have Better monorepo support high up on my todo-list.)
I think polylith should work unless we introduced a bug somewhere, I can test with a sample polylith project later today and confirm jt
Thanks @UKFSJSM38, much appreciated!!
@UGNFXV1FA FWIW, this has never worked for me, nor does Calva's jump between source and test functionality, but we've never been able to repro outside of our repo at work -- it works in "simpler" repos just fine.
One "quirk" of our repo at work is that the Clojure code is all in a subfolder of the main repo so we have wsmain/.lsp
but the Polylith workspace is centered on wsmain/clojure/deps.edn
-- although, again, in a repo that seems similar to that structure, things appear to work just fine.
I'd suggest trying to create a minimal repo where you can see this problem and put them up on GitHub to see if we can debug things. I'm definitely curious about this problem too (although the addition of (ns ...)
is of such little value to me since I want to add a copyright header etc anyway).
Thanks @U04V70XH6 I can certainly try to reproduce, I’ll get back. (The ns
thing was just one example indeed; especially the incorrect references is not helpful.)
I have setup a repo that reproduces the described issues for me: https://github.com/svdo/polyrepro. If you have some time it would be great if you could verify that you experience the issue as well in that setup. Thanks!!
Can we device tests of clojure-lsp alone here somehow. See if we can isolate it to what should be changed in Calva.
@UGNFXV1FA I found the issue on clojure-lsp, It works for https://github.com/furkan3ayraktar/clojure-polylith-realworld-example-app because all source-paths are on the root deps.edn, so clojure-lsp find correctly via its default dev
and test
aliases:
because clojure-lsp doesn't scan nested deps.edn of polylith projects, is that really common? I could try to support that somehow but I'd need to know when should we seek for nested deps.edn and the correct rules for polylith projects
would it be enough to support :local/root
deps.edn scans on :extra-deps
and :deps
on deps.edn root and aliases?
@UGNFXV1FA I'm implementing support for :local/root
search following ☝️ and it's fixes your issue on your sample :)
I'll polish a little more and do more tests and let you know, I created this issue to track that: https://github.com/clojure-lsp/clojure-lsp/issues/652
That’s awesome @UKFSJSM38!! Yes, I think it makes sense for it to work like that; after all, :local/root dependencies are sources that you want to know about while developing, so taking them into account makes sense.
@UKFSJSM38 That is the issue that Cursive has with Polylith too -- it can't find source via :local/root
-- which is why the Polylith docs says to use :extra-paths
as a workaround for that. But the "right" way is to use :extra-deps
with :local/root
deps for the bricks (`bases` and components
).
So I'm really glad to see LSP support this, thank you!
Good to know! Yeah, I cannot see any issues checking nested :local/root
so I think there is no reason besides complexity why clojure-lsp/cursive can't check that.
Probably fixing that should fix other mono-repos support as well 🤞
I wonder if that might also fix the switch between source and test files in Calva or whether that's an unrelated bug?
It probably is. I think the code is pure Calva and doesn't lean on anything from LSP. It was mostly a joke on my part, sorry.
Fixed on clojure-lsp master! If anyone wanna test it before the next release (couple of days), you can just run make
on clojure-lsp to generate a dev clojure-lsp
binary.
@UKFSJSM38 Now running clojure-lsp from master, and I can confirm that it works for me too. Super-happy and grateful! 🙂
Good to know, thanks @UGNFXV1FA
cmd-period > “Add require ’[…]” 🎉 Love you @UKFSJSM38 :)