How to disable indexing for cetrain directories?

Hello,

I have directory with compiled templates, javascripts and css files. It is really big and it is under main project folder.
Is there any way to disable this directory from indexing? Every time when I'm recompiling templates, javascripts etc. I have to wait and my pc getting stuck.

Thank you.

32 comments
Comment actions Permalink

Settings|Directories -> Use Exclude button on folder

22
Comment actions Permalink

I'd really love to find a way to exclude directories from the inspector without having to exclude them from the project as a whole.  (read: PEAR installations, 3rd party libraries, etc.)

So far, I haven't been able to find that option.

1
Comment actions Permalink

Hi signe,

There is a way which will fall under "as a whole" definition:
1) Remove such folder (if present) from Project in Settings | Directories (mark folder as excluded)
2) Add such folder in Settings | PHP

Such folders now will still be displayed in Project view: not under Project root but under External Libraries instead. As a result you still have code completion, but Search/Refactor/TODO/Inspections will not apply to such files. This is perfect (specially designed) for 3rd party libraries (like PEAR, Zend, Smarty etc)

0
Comment actions Permalink

One word: Scopes!!! This is one of my favorite features of PHPStorm. We have a HUGE project and many of the files are interdependent, and Scopes all me to view and process only those related to certain applications within the project....AND you can Inspect on them. I created a scope for my project, because we have some third party files (like prototype.js) that we don't want scanned.

1
Comment actions Permalink

And how would you do it before PHPStorm starts (from the commandline or by editing the config file)? Why do I ask? Well the application starts indexing right from the start so it would be convenient if you can exclude folders before it starts.

0
Comment actions Permalink

Hi Rene,

Create an empty new project, add 1 empty folder. Now perform those steps (remove from on replace add to another). Close project, go to .idea subfolder and open PROJECTNAME.iml file -- see the structure and replicate it in a similar way in your real project.

Alternatively, in your real project, temporarily make those problematic folders empty (move all files/subfolders elsewhere), launch PhpStorm and mark required directories accordingly. Then move all files back.

Yes -- far from perfect and easy solution. But it works. And if you are really strugling this should help.

0
Comment actions Permalink

This is probably the most inconvenient thing on InteliJ products.
Its not only on PHPStorm, its also a problem on Webstorm and all others in the family.

Doing the exclusion on the package level as instructed by Alexey Gopachenko does not work.
Doing what Andriy Bazanov also does not work as is almost same as alexey tip.

Keith Davis is talking about something else, and his explanation is confusing, I don't get it at all.

Second tip from Andriy Bazanov is not valid, I'm not paying a enterprise product to have to edit config files by hand.

Where is the official answer for this? Its really annoying problem and there is no "official" answer that works on the entire web. :|

1
Comment actions Permalink

Kirill's post starts off with "disable indexing", but then states that the issue is during "recompiling templates" which can be restricted to recompile within a scope, and has nothing to do with the indexing process.

We have a project with probably need 25000 files and indexing is not an issue for us.

So if the issue is compilation being too slow, the scope can be restricted, but if the issue is just reindexing period, that's a whole different problem and I'm not sure what solution would work. 

So you want to exclude files from being indexed, but not from being accessible by the IDE? I'm confused.

0
Comment actions Permalink
Where is the official answer for this? Its really annoying problem and there is no "official" answer that works on the entire web. :|

Alexey's answer is official, actually. He is the team lead.

Doing the exclusion on the package level as instructed by Alexey Gopachenko does not work.

Could you please describe how exactly it doesn't work? Are the files still being indexed after you set them as Excluded?

0
Comment actions Permalink

I build a 'js-dev' directory with require.js into a 'js' directory. It causes massive duplicate code completion and was the cause of some memory and performance issues I was having during reindexing after each build.

After I exclude 'js' from the project, I no longer have issues and, of course, no duplicate code completion.

However, I lose deployment of that directory. Adding a separate 'js' directory mapping in deployment regains the loss of that feature.

This works for my case, but it would be convenient to exclude from indexing without having to lose other "in project" features. If it's possible to do this with scopes, please explain.

1
Comment actions Permalink

> This works for my case, but it would be convenient to exclude from indexing without having to lose other "in project" features. If it's possible to do this with scopes, please explain.

Unfortunately, it's not. Almost every single IDE feature relies on indices.

 

1
Comment actions Permalink

I think it would be a good idea to allow pausing the indexing.

For me, while it is indexing I am able to go into settings, but I am not able to add excluded files or set the scope. I am likely missing something, but I was thinking that if it is still indexing then there is not yet an available context for the directories to exclude or set the scope - if it uses the indexing to do that. 

It seems the previous suggestion works, and for the next project set up I can consider that. 

2
Comment actions Permalink

Phpstorm 2017.2 indexes windows/system32 directory and it's not inside my project.

So: Settings|Directories -> Use Exclude button on folder    is absolute noncens.

0
Comment actions Permalink

@Roger

>Phpstorm 2017.2 indexes windows/system32 directory and it's not inside my project.

1) 2017.1.2 is the latest stable version. 2017.2 is not yet available to the public in any form.

2) Please show what you have in "Settings | Languages & Frameworks | PHP --> Include paths"

It's possible that you have "." entry. If you do -- please remove and see if it will help.

But then .. you are on Windows and this should only affect Mac/Linux users only (I would think)

3) The only other possible thing I could think of -- you may have some symlink in your project (or folder that is referenced in your project -- e.g. external library) that leads to such folder. Or maybe it's referenced via some composer.json or alike file?

 

In any case: "windows/system32" is a very unusual and unexpected location to be indexed.

If nothing -- backup your PROJECT/.idea folder (this project settings) and delete it (while IDE is closed, of course). Then just use "Open" from Welcome screen and point to the project root folder -- IDE will create new project from existing files.

1
Comment actions Permalink

THANX !!

The "." in my include paths made the difference... You just made my day a lot better :-)

Yes, your right. I'm using 2017.1.2. Sorry for that...

 

 

 

0
Comment actions Permalink

I have to say that because of indexing I have to use Visual Studio Code. I hate that I cannot use my favorite IDE because of this one issue. And, why does it bother to index until I even set what directories should be? And can it ignore node_modules by default? We all have to use Visual Studio now because we have a hide shared module application and it is otherwise unable to start up unless I gave it all day to index. Actually I tried that a few times, but it never finished.

All I could figure was to create an empty application, then create the scaffolding/directories, then set what each folder is, and then import the application little by little. I had never been able to finish that. By the way, no issue on a Mac, just Windows. The problem is that we have no choice but to use Windows... I love WebStorm for JavaScript development, it's just this problem. Also, the spelling feature irritates me. I absolutely do not need anymore warnings, and spelling is never accurate. It tries to spell check code, and product and company names... etc. I turn it off and it turns back on again. Perhaps that issues is just my settings, but I would only want spelling in HTML content files, and never code. I don't know why I went on this tangent. Perhaps I am just finding another reason to feel better about another editor- I just prefer WebStorm over all others. Please change indexing.

0
Comment actions Permalink

Drew, another way of temporary disabling indexing is File | Power Save Mode.

1
Comment actions Permalink

I had this problem in 2017.1 because my first include directory was "." - not sure where that came from, but it changed location depending on how I started PhpStorm,  I think previously this was assumed to be project root, but it certainly isn't for PhpStorm 2017.1.4 (build #PS-171.4694.2)

0
Comment actions Permalink

AJ Lewis, it's been a bug, fixed already: https://youtrack.jetbrains.com/issue/WI-34845

0
Comment actions Permalink

I don't understand how can I disable folders by mask? And info at the top is outdated. Now you can disable folders for indexing within Project Structure window under Modules section.

0
Comment actions Permalink

@Slogic10 There's no option to exclude folders by mask - you need to mark them as excluded via right click > Mark As > Excluded or from Settings/Preferences | Directories.

1
Comment actions Permalink

Oddly enough, I just encounted the same Sys32 inclusion issue that Roger encountered.  Very strange since that dir was & has never been included as a lib in any of my projects.  I'm running 2017.2.4.  

0
Comment actions Permalink

"Settings|Directories -> Use Exclude button on folder"

This is a lie.

Because the folder/file needs to exist before it's excluded, if you exclude it you wont benefit from the code help but your IDE will be unusable during the indexing that WILL happen no matter what.

0
Comment actions Permalink

Opichou, since 2017.2 you can exclude directories before they were created by using a pattern.
Also, indexing can be stopped at any moment by File | Power Save Mode.

0
Comment actions Permalink

@keith Thank you for the tip about scopes; this seemed to help me resolve a lot of the duplicate class definitions caused by composer creating a symlink to a a sub-repo included in the project ... just created a scope and explicitly added everything I wanted.

1
Comment actions Permalink

Settings|Directories is not an option in my IntelliJ IDE

IntelliJ IDEA 2017.3.4 (Ultimate Edition)
Build #IU-173.4548.28, built on January 29, 2018

0
Comment actions Permalink

@Theodore Omtzigt 

IntelliJ IDEA has more complicated settings as compared to PhpStorm -- it can have multiple modules while PhpStorm project can only consist of a single module of specific type (WEB_MODULE).

Therefore you should look at Module/Project settings rather than general IDE Settings (sorry, not IntelliJ user so cannot be more specific).

As alternative -- try right clicking on a folder in Project View panel and use "Mark Directory as" submenu.

0
Comment actions Permalink

Ho about not indexing directories that are ignored in `.gitignore`? You could also have something like `.pycharmignore` and use it? That way the indexing will not even start, otherwise a huge directory freezes PyCharm long enough that "Right Click/Exclude" will be impossible (while indexing)

 

Actually there is an issue for it:

https://youtrack.jetbrains.com/issue/IDEA-140714

 

0
Comment actions Permalink

Beep. This is driving me insane. I have symlinks to HUGE resources directories and Idea is FREEZINg while "indexing". I have raised this as a separate issue elsewhere I believe as well as "PINGED" similar open issues. Here was one that was closed. https://intellij-support.jetbrains.com/hc/en-us/community/posts/207671405-stop-Indexing-please- 

 

Also here:

 

https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000113964-Ignore-symlinks-in-project-indexing-code-completion-etc-

 

 

Seriously, guys!!!!!!!!! Fix this.  How hard can it be to NOT index .gitignore entries and/or symlinks and/or directories as "ignored".

 

I can NOT use your product.

3

Please sign in to leave a comment.