Eclipse exclude php files from validation but not build
Asked Answered
M

1

6

I have a very simple use case. Eclipse Kepler with PDF. New project with PHP nature.

One file at the root

# test.php
<?php

$fu = new Fu();
$fu->bar();

&

One file in a directory

# vendor/vendor.php
<?php

class Fu {
    public function bar () {

    }
}

&

Both files show an error in the Problems view. I need to exclude all files under vendor/ (recursively) from the Problems view, while keeping the code completion on objects defined under vendor/ (recursively).

Desired result:

  • code completion in test.php still works on Fu and all classes defined under vendor/
  • the Problems view doesn't show any error or warning on files under vendor/
  • the Problems view shows errors and warnings on other files as usual
  • the Problems view doesn't depend on the selected element

What I tried:

  • removing vendor/ from the Build Path also removes all code completion on classes under vendor/
  • Project > Properties > Validation > Enable project specific settings + PHP CodeSniffer Validator settings > Exclude Group > Folder: vendor doesn't do anything at all
Mulligatawny answered 10/10, 2014 at 11:7 Comment(0)
W
12

You should install latest PDT (3.3.1 is available on marketplace) into your eclipse kepler instance.

This version have special feature: "library dir". This functionality allow you to disable all validators (JS/PHP/HTML/CSS...) on buildpath dir.

Wheatear answered 10/10, 2014 at 13:4 Comment(4)
Wonderful. I just had to right-click on the vendor folder and select "Use as Library Folder".Mulligatawny
Just a little update. In Oxygen (4.7) right click on a folder and choose "Use As Library Folder".Shiekh
Thank you very much, BTW this should be noted in the official docs "This functionality allow you to disable all validators (JS/PHP/HTML/CSS...) on buildpath dir." . I'v been looking for this feature for a long timeKirkwood
Help from this address is here due historical reasons. Latest help is available at help.eclipse.org/photon. Anyway it's a little bit outdated ;)Wheatear

© 2022 - 2024 — McMap. All rights reserved.