JavaScript Libraries type - global/local?

Everytime I create a new Javascript Library, it will set its type to "Global".
So doesn't matter which project I'm in, I can see those js libraries in the project settings.
However, those libraries should only be in that specific project,
but I can't see how to change the type "Global" to something else... Like "Local" or something.
Any help?

Image 8.png


Right now there is no concept of project JavaScript library. Any created library automatically becomes global. You may submit a feature request at


Think of it as of a registry of all libraries you have in your toolset.
To choose tools for a particular project, make the changes in the JS Libraries' submenu 'Usage scope'.


But in each project file-system I have different Javascript libraries. Alongside them are my own scripts and plugins.
For example:
So here _init.js and app.js are my own stuff. How would I set this project up?
Should I copy all my libraries to a global path and organize them into libs and set their scope in my project?
Won't phpStorm index these js libs I have in js/libs/* and have duplicate definitions in index?

I'm totally confused.


I think the library repository is only for injecting global variables into code completion. I sometimes work on projects, where the library files alone are not present as files on my disk, and it's a life-saver in such circumstances. Once you have the entry point added via the JavaScript libraries functionality, like eg. the jQuery object, and then have per-project specific files which add up to, say, jQuery.fn, or jQuery object alone, the code completion should work just fine.
I, for myself, keep things like jQuery, underscore.js, ext-all.js, sinon.js, and the likes, in the library section, set the scope accordingly to what I need where I need it, and then write my own stuff, which is aware of that globals.

If it is the jQuery plugins which keep you puzzled, I wouldn't be adding them as libraries, if there are many. The IDE should be able to figure it out, that they are attaching functionality to the jQuery.fn object.


Hey thanks for the answer.

What did you mean "I, for myself, keep things like jQuery, [...] in the library section" ? Where do you physically put them?
What happens when you have different projects that use different versions of libraries,
like Project A uses jQuery 1.3 and project B uses jQuery 1.6.1 for the sake of the example.


If I have a project with jQuery lib within its project files, and I set a jquery library and apply it through the project scope,
phpStorm WILL have a duplicated index pointing to both jquery libraries. One that is physically inside my project files,
and one that was set through the Javascript libraries, a picture tells a thousand words:


Oh, I feel you there. And that's one reason why I usually include jQuery by referencing it from Google's CDN, and not having it directly in my project.
And to answer your question, where I really keep those libs, let me describe my workflow:

  1. in an html file, where I need a library, insert script tag with src set to a CDN with the library I need
  2. when caret is on that src, a light bulb appears, and it has an option to download that library (JetBrains blog post explains it pretty well) - and voila, I got the lib in my lib repo (WebIDE saves it to it's directory structure somewhere, I don't really care where
  3. set usage scope as needed

As a side note, I read that blog post again. It's intention is, it seems, to not only enable integration with libs that are not physically present in your project, but to cut down the available scope of methods/properties in the autocomplete popup.
The behavior you showed with that pic, I think this deserves a ticket for a feature request - I would love to see an option to physically include the libs from my libs repo in my project, in a way that it would sync with the repo - when I change the file in the repo, it automatically changes in each project using it. This way I could maintain my private shared codebase between projects. Yay, it gives me shivers :)
Even more, have the libs in repo point to a CDN as an option, so your 3rd party libs are always up to date, and sync with projects depending on them automatically.


Hehe.. Dreams come true with phpStorm. But right now I think the Javascript Library feature is an unpolished gem.
I'm still confused. At the beginning, I created separated libraries, that included the actual javascript I'm writing in the project.
It's a big project, so I have client-side controllers, application library, ... I created for all of them separated organized libraries,
and one for the vendors. (jquery, jqueryui, and so many more).
But as soon as I moved to a different project, all the js libraries were still there under Project Settings (!!) | Javascript Libraries.
Confusing. I wrote this question. Understood that js libs are only global libs, so removed all the libraries, and copied some
libs in .WebIde10/system/extLibs and created a few global js libs...
But now, I have this duplication in the autocomplete index search like I showed above. Of course I have those libs in my project,
so phpStorm will be confused between the libraries in the jslib setting, and the actual file in my project..

I use the jQuery CDN too, but with a fallback:

 <script src="//"></script>
<script>window.jQuery || document.write("<script src='<?php echo URL::site('media/js/libs/jquery-1.6.min.js') ?>'>\x3C/script>")</script>