Fork me on GitHub

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 and, 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).

☝️ 1

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: If you have some time it would be great if you could verify that you experience the issue as well in that setup. Thanks!!


Nice name!


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 because all source-paths are on the root deps.edn, so clojure-lsp find correctly via its default dev and test aliases:


It doesn't work for your sample though, clojure-lsp only find this source-path:


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:


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

👍 1

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


what feature is that? 😅 maybe is something vscode specific?


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.

😅 1
👍 1

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.


nice Eric! gratitude

👍 1

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


Get in line, @UGNFXV1FA. I also love @UKFSJSM38!

calva 1

haha thank you both !