-
-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Projectile-project-type could return the wrong project type when called with argument #1806
Conversation
bad6306
to
b542288
Compare
I could have just bind the default-directory locally in the middle of the stack to fix the issue. But currently I chose to go deeper down the function stack to make those functions taking the same optional dir as argument, kind of give them a more unified interface. Which way do you prefer? |
1baf138
to
2e79bfd
Compare
Your suggestions seem reasonable, but I'm not quite sure what exactly is the problem that you've encountered (and I don't see any new tests that's illustrate it). I got that somewhere the project detection is failing, because it's not acting on the right folder, but you didn't say where exactly. |
7c5e1d6
to
73e2042
Compare
73e2042
to
e8c5d50
Compare
Here is a branch with just the commit for the tests for the issues. Briefly, what I did was calling |
Got it. Thanks for working on this! 🙇♂️ |
Expected behavior
(projectile-project-type DIR) should return the right project type.
Actual behavior
(projectile-project-type DIR) sometimes return the wrong project type
Why
The problem is, some logic branches inside
projectile-project-type
involve calling(projectile-detect-project-type)
which use thedefault-directory
instead of the DIR we supply.Potential Fix
Amend
projectile-detect-project-type
to take optional argument DIR(just likeprojectile-project-type
).Pass along the input from the projectile-project-type to
projectile-detect-project-type
Steps to reproduce the problem
Let DIR1 and DIR2 be 2 directories from projects of different types
Call (projectile-project-type DIR2) from a DIR1, you will get DIR1's project type instead of DIR2's(given that DIR2's project type is not cached)
Environment & Version information
Projectile version information
Emacs version
GNU Emacs 29.0.50 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version 10.15.6 (Build 19G2021))
Operating system
macOS