Book Image

PhpStorm Cookbook

By : Mukund Chaudhary
Book Image

PhpStorm Cookbook

By: Mukund Chaudhary

Overview of this book

Table of Contents (16 chapters)
PhpStorm Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Excluding unwanted directories from the index


Did you try imagining why on earth PhpStorm has information about all the files you added in your project directory structure? How does PhpStorm detect the changes that you make to the disk by adding images, text files, and so on, and manages to show them in the Project view? Yes, the answer is indexing.

Getting ready

PhpStorm indexes everything that comes its way. Thus, it remembers the files and folders properly. But there is an overhead involved in this system. The more the number of files in the project, the longer the index created is. If PhpStorm decreases time in searching for files and folders by maintaining an index, how will it manage searching in the index itself when the index list has increased to a very large size?

How to do it...

You can help PhpStorm by performing the following steps:

  1. Go to Settings | Directories.

  2. Select a directory, and all you have to remember from here are three keyboard shortcuts: Alt + T, Alt + E, and Alt + R. Consider the following screenshots:

How it works…

Alt + T will mark a resource as a test resource, E will exclude it from indexing, and R will mark it as the content root. For you, the increase in speed will come from the magic key combination Alt + E. Be ruthless enough to apply this magic to all those directories that you decide are not important enough to be indexed.

Note

A test resource is a type of resource, most probably some PHP script, some directory, or some other file type that is used in the testing process. So, you can mark a resource as a test resource once you know that it will be useful for testing purposes.

PhpStorm, being a careful(ly written) piece of software, maintains a list of all the files that you save in your project, using indexes. So, a large number of files means a longer index and hence the potential danger of slowing PhpStorm down. An excluded resource is a resource—some file(s) or folder(s)— that you have asked PhpStorm not to index.

A content root is a folder or directory under which the contents of the resources you are working on is contained. You would easily be tempted to ask "what purpose does it serve?" The answer is rather simple: it maintains a clean workspace for you (everything in life need not be complicated)!