Fork me on GitHub

I have a big, big git repo with multiple Clojure projects. Is there a way to make projectile and clojure-lsp aware of the individual (sub) projects? Right now both use the root of the git repository as project root and that messes many things up. I found some documentation about how projectile discovers projects but it's not obvious how to configure it. My google-fu is failing me, and what I'm finding is not really helpful 😢


you can put a .projectile file at the root of your subproject. For lsp it worked out of the box for me, my sub projects all have a project.clj file


I'd rather not store any special files in the repo, other people on my team use different editors - I thought project auto discovery can be configured somehow


i think the git repo takes priority, but maybe it's configurable. Also you can just add the .projectile file to your global gitignore


Yeah, that could work. I've seen that that docs page and suggested changes didn't seem to work, but it might have been me doing something wrong - I'll give it another shot :thumbsup:


even if you swaitch projectile-root-bottom-up and projectile-root-top-down ? what's your "project specific file" ?


you can use lsp-workspace-folders-remove and lsp to remove and add a project


fixing projectile is not enough if you have lsp-mode thinking your project root is still the mono-repo root, so you need to do this ☝️


90% of it is project.clj rest would be either package.json or Gemfile - all of them are part of projectile's default setup. And yeah, the order is (projectile-root-bottom-up projectile-root-local I'll try the .projectile file approach


@UKFSJSM38 ah, I didn't realize that lsp doesn't rely on projectile, then again - wouldn't it scan for project.clj in the same fashion as projectile?


lsp-mode always guess the project root and prompt with a suggestion, but you can manually choose a different folder


Must be something about my config because I only see a warning about 4000+ files being indexed :-)


that's lsp file watchers warning which can be customized as well


lsp-workspace-folders-remove and lsp should help with configuring properly


Thanks, I'll give it a go :thumbsup:


you may have misread the doc: in your case you'd want projectile-root-local projectile-root-top-down projectile-root-bottom-up projectile-root-top-down-recurring but this may not play well with some other projects, so i'd use .dir-locals or .projectile anyway


oh, I'll try that later :thumbsup: thx


@U02F0C62TC1 ok, that did it for me, at least wrt projectile itself. Thanks!

Chris Clark17:08:00

I also have this problem in monorepos. I wrote up my solution, using way too many words, here: I’d be interested in better ways to do this.