In a large rails code base, I expect projectile-toggle-between-implementation-and-test to toggle between my test file and implementation file.
This works fine in a small rails project, but it doesn't in my organizations monolith. When I run the M-x projectile-toggle-between-implementation-and-test (I'm using spacemacs so it's bound to SPC p a) in both a test file and an implementation file I receive the following message:
No matching test file found
I suspect this has to do with the fact that this is a large rails app. It seems like (I'm new to emacs list, so forgive me if I'm wrong), that this method searches through every file in the project to find the appropriate associated file. In a large rails app like mine (or the one I link to in steps to reproduce), it seems as if it's timing out while searching.
I can't give you my repo, but I've cloned the Discourse repo and I can reproduce my issue.
Should be noted that I'm using Spacemacs and it includes projectile-rails. I wasn't sure if the issue was there, or here.
Projectile version: 20170106.606
GNU Emacs 25.1.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911))
OSX 10.11.16
+1
I looked into this issue (as I'm also suffering from it) and discovered the following...
In the discourse repo linked to above, projectile-project-info reports the _project type_ as ruby-test. However, it should be rails-rspec. If the _test_ folder is deleted (i.e., rm -fr test from the project dir), then projectile will see the project type as ruby-rspec, and will properly switch between test (spec in this case) and implementation.
In the project I'm working on, which is also a Rails with RSpec project, the _project type_ is reported as npm. If I remove the package.json file, projectile will see the project as ruby-rspec, and the toggle between implementation and spec will work properly.
I found documentation* that seems to suggest certain things can be overridden with a .dir-locals.el file in the project root. However, I was unable to get the project type explicitly set, due to insufficient elisp skills :slightly_frowning_face:.
thanks @darrenboyd your comment got me to look into this and I got it working, here's an example .dir-locals.el that works for me:
((nil . ((projectile-project-type . rails-rspec)
)))
You might have to restart emacs for the changes to take effect.
Most helpful comment
thanks @darrenboyd your comment got me to look into this and I got it working, here's an example
.dir-locals.elthat works for me:You might have to restart emacs for the changes to take effect.