-
Notifications
You must be signed in to change notification settings - Fork 3
[RFC] better project root detection. #3
base: master
Are you sure you want to change the base?
Conversation
Would it make sense to expose a method in the Phpactor plugin |
It make sense to me.
|
It doesn't detect the project root, it just uses the directory in which VIM was initially loaded, I think there are too many edge cases when detecting the root (and the magic behavior can just be confusing). I guess the other consideration is that this would couple this plugin to the |
In what case? phpactor is always depending on vendor/autoload.php generated by composer. And I haven't seen a PHP project using composer without putting vendor directory to the project root. If it doesn't work by default, then the user need to configure it to work. But with a static value
I have already documented the requirements to the README page. It's not an issue. |
I like this PR. The project detection was removed from If the detection fails for a project, a simple condition could be happen to the script detection in order to manage this case. I approve this PR because it's all I need right now to use this I agree with @roxma to handle the project root detection method within the |
|
You could take the parent |
More edge cases - what if the project doesn't use git? git submodules? (eventually Phpactor won't care which VCS you use, or even if you don't use one at all). |
I get it. So it shouldn't be auto detected for phpactor.
If you're in a sub project, it doesn't matter if you're editting sub-project's files and treating it as a project root. So it's safe for code completion usage, but unsafe for refactoring usage. But split them will break consistency between plugins. |
I'm not sure -- I think @cmizzi mentioned he was using an auto |
I agree with @dantleech for this point of view. But, the solution could simply be to retrieve until latest found |
hmm I'm more concerned about the security issue mentioned by @dantleech If there's no better solution. I will merge #2 instead, for security and consistency |
Actually current PR doesn't traverse to the root of the FS. It fallbacks to Further more, using a static var It's very common for vim users to There're several vim plugins created for |
I think this PR provides better project root detection, for most composer based php project.
It also works when you're openning a file without being in the project root. A typical use case would be openning files with MRU.
Note that this PR conflicts with #2 .
// cc @cmizzi @dantleech