This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Treat vendor directory as include path | ||
---|---|---|---|
Product: | php | Reporter: | andreas.benzing |
Component: | Composer | Assignee: | Tomas Mysik <tmysik> |
Status: | NEW --- | ||
Severity: | normal | CC: | XedinUnknown |
Priority: | P3 | ||
Version: | 8.0.1 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Bug Depends on: | 254713 | ||
Bug Blocks: |
Description
andreas.benzing
2014-05-28 17:05:23 UTC
This would be great to get fixed / handled. Status is NEW? This is not an enhancement, but a bug. This causes us to waste time, having to manually find the right files, instead of CTRL-clicking on class and method names, and having to type full names while switching back and forth between tabs. NetBeans has good support for auto-complete and related stuff, which I am very happy about. However, this issue throws it all out of the window, because most people will use Composer (hopefully). Definitely not a defect, sorry. One can easily add any directory to the global/project Include Path via IDE Options/Project Properties dialog. Thanks. Tomas, I've added the vendor dir as include path. However, I do not get any hints or completion from the libs in that folder. The directories appear in the Projects panel, under Include Path. However, they are all grey, possibly due to being in .gitignore. I also tried adding the vendor dir to "Extra Folders for Code Analysis", but couldn't. Error appears below: "Folder "vendor" is not underneath Source/Tests/Selenium directory." So, how can I get those scanned and get completion/hints from the code in the vendors dir, while having it ignored by Git? (In reply to XedinUnknown from comment #4) > I've added the vendor dir as include path. However, I do not get any hints > or completion from the libs in that folder. The directories appear in the > Projects panel, under Include Path. This should definitely work but please verify that the vendor folder is not amongst Ignore Folders (in Project Properties). You can also try to clean the cachedir. > However, they are all grey, possibly due > to being in .gitignore. Yes. > > I also tried adding the vendor dir to "Extra Folders for Code Analysis", but > couldn't. Error appears below: > "Folder "vendor" is not underneath Source/Tests/Selenium directory." This is only for code analysis, as label says. > So, how can I get those scanned and get completion/hints from the code in > the vendors dir, while having it ignored by Git? See my first paragraph of this comment, it should work. Thanks. [1] http://wiki.netbeans.org/FaqWhatIsUserdir Tomas, you are not right. Vendor dir is a (ignored) part of project because composer.json and composer.lock lives in a project's root dir and those files are responsible for installing dependencies in project. Vendor dir itself is ignored because there's no need to commit all external libraries. Since it is part of project it can't be added to Include Path ("already part of project" error) and adding it to "Ignored folders" causes that directory disappear from project tree, so vendor classes cannot be navigated and so on. On the other hand, vendor dir is analyzed just like rest of the project. For example, I have added "frenck/php-compatibility" and some files there contains errors on purpose (for PHPCodeSniffer). It causes that whole project is marked as invalid, but I don't need NetBeans to check vendor libraries since I don't write them, I just use them (and they're working fine! doing what they supposed to do). Would be great if it could be handled somehow. Not 100% sure yet, but it would appear that there is something different about the way the vendor dir is scanned. It's true that after its addition to the include path of NetBeans, I get all features *in my own codebase* that depends on the code in the vendor dir. I am able to see what methods are overriding vendor methods, can Ctrl + click vendor class names etc. But it seems that when I go to the code in the vendor dir, these features are not available. Example: In my PHP code I have a class `JoinAwareInterface`, which has a method `getJoinEntities()` with return type `ExpressionInterface`. If I Ctrl + click that return type, I go to the above mentioned class declaration in the vendor dir. That class extends `EvaluableInterface`. However, when I click on *that* class name, I am not taken to the declaration of `EvaluableInterface`, which is declared in the same vendor dir. This is probably what originally lead me to believe that the vendor dir isn't being scanned. How can this be fixed? Is this the intended behaviour? I have to agree in that errors within the vendor directory cause problems for the whole project. Many of the errors are actually related to a third party's test files and are not real errors at all. We need a way to tell netbeans to treat the vendors directory as if it were part of the "include path" but not part of the "project source". Also, all these vendor files should be "read only", or at least we should be given the option to set it so. I have often used 'find and replace', only to have it also change vendor files. This makes bugs hard to find as they are not within our own source, and unless cloned from git, composer will not detect the changes. Even when they were cloned, composer will not update until the issue is fixed (revert changes or delete the package). Marking 'vendor' as external to our source, will 1) eliminate errors within that directory effecting the 'real' source, and 2) speed up 'find and replace' (it doesn't need to look in the vendors). |