projectile
projectile copied to clipboard
Wrong project root inferred in a nested project which is inside a bigger project (two different languages).
Expected behavior
I am using Spacemacs (and thus projectile) and LSP.
I have an Elixir project which uses the rustler library which generates a Rust project inside the Elixir's project native/ sub-directory. I did touch ~/code/elixir-project/native/rust-project/.projectile to provide a hint that this is a project nested inside another project. Then I opened a Rust file, say, ~/code/elixir-project/native/rust-project/src/lib.rs and then rust-analyzer complains that it cannot find any projects inside ~/code/elixir-project.
Actual behavior
I expect projectile to infer that the current project it's operating in is ~/code/elixir-project/native/rust-project.
I also tried explicitly setting the project path but that did not help.
Steps to reproduce the problem
- Have Rust and
rust-analyzerinstalled. - Have Spacemacs with projectile and LSP enabled. Haven't tested with plain Emacs.
- Have the Rust layer and enable LSP for it.
git clone https://github.com/dimitarvp/xqlite.git- Open the file
native/xqlitenif/src/lib.rs. - The Rust LS won't start (you'll see a warning that it's still loading, and an unknown error message).
- Switch to the
*rust-analyzer::stderr*buffer and find this message in there:[ERROR rust_analyzer] failed to find any projects in [AbsPathBuf("<your_path_to>/xqlite")].
Environment & Version information
Projectile version information
Projectile version: 20200517.1330
Emacs version
GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95))
of 2020-08-12
Operating system
macOS Big Sur 11.0.1
Questions
- Are nested projects supported by projectile? If not, I suppose this entire issue is redundant.
- If not, are there plans for such a feature?
- Is there any workaround I can apply? Touching the
.projectilefeels seems to have no effect.
Yeah, nested projects are supported, but you might have to tweak the project resolution behaviour, as outlined here https://docs.projectile.mx/projectile/projects.html#customizing-project-detection Can you tell me what exactly gets detected as the project root in your case? (in the sense of which of the default functions returns a root first)
I am not sure how to answer, not an Emacs expert by any stretch. Does the link you provided give me functions to run queries with which I can answer you? If not, can you tell me what to run in order to provide the info you asked for?
I am also running into this issue (with Emacs, Clojure and LSP), but adding a .projectile file to my sub-project fixed my issue.
Does projectile require a .git (or other SCM) folder? I added a .git directory to my subproject (just empty) and it also worked.
It's also possible that this is an LSP bug and that LSP looks for SCM folders first. For my case, adding an empty .projectile file helped though.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!
Curious, I thought projectile would also consider projectile-known-projects in its search, so I expected it to work without any markers if I just added the project into there.
Well, maybe I can customize it accordingly...
I am also running into this issue (with Emacs, Clojure and LSP), but adding a
.projectilefile to my sub-project fixed my issue.Does projectile require a
.git(or other SCM) folder? I added a.gitdirectory to my subproject (just empty) and it also worked.It's also possible that this is an LSP bug and that LSP looks for SCM folders first. For my case, adding an empty
.projectilefile helped though.
I add a .git directory in my subfolder, and everything works fine. Thank you very much.