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.
Please sign in to leave a comment.
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'.
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, 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,
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:
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.
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).
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: