39

Is it possible to exclude certain files from the TODO function in PhpStorm? For example, I'm using the highcharts javascript library. I don't want to see the few dozen or so TODO's they have marked mixed in with my own. I don't want to exclude this directory, because I still want to be able to view the files in a convenient manner.

Jesse Schoff
  • 750
  • 9
  • 24

4 Answers4

42
  1. In File > Settings > Scope add a new scope and make sure the files you like are green.
  2. Open TODO Tab View > Tool Windows > TODO (Alt + 6)
  3. In the top of TODOs click on Scope Based
  4. Below select your new scope from step 1 below Custom Local Scopes

enter image description here

PiTheNumber
  • 22,828
  • 17
  • 107
  • 180
41

Yes, you can -- via custom scope that would include all but unwanted files/folders (Settings | Scopes) and then just choose it in TODO window.

Check these articles for details:

P.S.
This functionality is available since v6 only.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
5

For libraries, there is a one click solution as I have just found out.

You can use the "External Libraries" feature to include the specific library folder, after which PHPStorm / IDEA will mark the folder as a library home and exclude it from inspection.

Note that you can include folders inside your project directroy, even though it's called "External" Libraries.

enter image description here

Michael Yoo
  • 489
  • 1
  • 6
  • 14
  • How do you add directories inside the project to External Libraries? – Jesse Schoff Oct 22 '14 at 17:50
  • 1
    @Mute Right click on External Libraries -> Select Configure PHP Include Paths -> Add the directory of the library you wish to exclude in the "Include path" section. The reason I said that internal folders are also exclude-able with this feature is because the vendors folder, which is a third party library folder, resides under the project root. Also, the reason I don't just mark the folder excluded is because if I exclude it, PHPStorm essentially treats them like text which means namespaces etc. inside the folder are not detected. – Michael Yoo Oct 31 '14 at 08:13
  • 1
    It seems that in the latest version of PHPStorm (2016.2.2), the folders within a project have to be excluded to be registered as External Library. This thankfully is automatically done by PHPStorm. So: 1. Mark folder as Excluded 2. Add folder to External Libraries – Michael Yoo Nov 13 '16 at 12:16
5

To exclude code (usually composer dependencies) from analysis.

  • Right click on desired folder
  • Click 'Mark Directory As'
  • Click 'Excluded'

Screenshot example below: enter image description here

Eddie Jaoude
  • 1,698
  • 15
  • 23
  • 4
    But as I've explained in my other comment, doing this will cause PHPStorm to stop ALL inspections - not just TODOs. This means PHPStorm will essentially treat the files as not being there at all. So that means no more autocomplete and also Namespace not detected warnings everywhere etc. – Michael Yoo Oct 31 '14 at 08:22
  • 1
    Will this exclude the folders from all operations (esp VCS) or just inspections? –  Oct 03 '16 at 20:48
  • @Scott yes, so do not – ricko zoe Nov 22 '16 at 11:04