Fork me on GitHub
Timofey Sitnikov11:06:18

Good morning all. I am trying to build my clojure environment. Does it make sense to use Iced with Clojure LSP? Or will they trip on each other?


They have some overlapping functionality but should not cause conflicts. Just be careful with keys mapping, iced maps <C-]> == and K by default


Hello folks, I am using VSCode with Calva, and references across namespaces do not work (i.e., they are not found). Our setup is a monorepo with several subprojects, two of which have lsp/config.edn at their root. I found that when I create another lsp/config.edn at the repo root, listing the union of the paths from the subprojects under "source-paths", all of a sudden, references work perfectly. I have not been able to understand why that should be so though. Shouldn’t lsp find all these paths regardless of whether I place them in the config file at the project root, or in a nested folder?


The issue does indeed seem to be caused by the fact that the source paths listed in the config files for subprojects are not taken into account, because in the absence of a root level config, I see in the logs:


This is so fast that it seems clear no paths were actually found that had to be analyzed …


By default clojure-lsp check for the default source paths (src and test) from project root, if you have a mono-repo you probably need to configure a different :source-path


Also clojure-lsp checks for deps.edn/project.clj on the project root


Thank you! I think I am getting closer. 🙂 One more question: in the documentation, it says that clojure-lsp will go upwards from the project root looking for config files. I am assuming once a config is found, this search will stop, correct? So if • my directory structure is dir1/dir2/dir3 • my project root is dir3 • I have config.edn for lsp both in dir1 and dir3 … then the configuration in dir3 will be taken into account, whereas the one in dir1 won’t be. Is that right?


From if you have the project root as /tmp/dir1/dir2/dir3 and config on dir1(`{:a 1}`) and dir3(`{:b 2}`), it will deep merge both:

(resolve-project-configs "file:///tmp/dir1/dir2/dir3" (io/file "/home/any"))
=> [{:a 1} {:b 2}]

👍 3

basically, clojure-lsp wil recur until / searching for .lsp/config.edn


@URQPRL0HK We have a monorepo at work and use the CLI / deps.edn and after trying various configurations, we’ve ended up with a “primary” deps.edn at the top of the repo — and run an “everything” REPL from there and that’s also where LSP’s root is so it “sees” all code (all 113K lines in 40+ subprojects). Read the two “deps.edn and monorepos” posts here for more details: We’re currently migrating things piecemeal to the Polylith architecture, which takes a similar approach with a workspace-level deps.edn and a :dev alias for “everything” for the REPL (and LSP etc).

👍 6

(we used to have a more subproject-based approach but it just wasn’t amenable to working with tooling across the whole repo)


you can test what is the config being retrieved with server-info command (not sure how to get this on Calva, do you know if it's possible @U9A1RLFNV?)


Thank you, very helpful


Yes, there's a Calva command for that, Calva Diagnostics: Clojure-lsp Server Info .

🎉 3
❤️ 3