PhpStorm: set a specific library version as a project library - phpstorm

I am trying to make JQuery 1.8.3 and JQuery UI 1.9.2 project libraries in PhpStorm 2017. When I go to Settings >> Languages & Frameworks >> Javascript >> Libraries, there is a dropdown near the top with two options:
TypeScript community stubs: here I find simple listings for jquery and jqueryui with no version information.
Official Libraries: here I find listings for jQuery 2.0.0 and jQuery UI 1.10.2
What's the recommended way to get IDE support for the specific versions of these libraries that I intend to use on my project?
Update
I have downloaded the uncompressed jQuery 1.8.3 file and saved it on disk. Then from Settings >> Languages & Frameworks >> JavaScript >> Libraries I selected Add... to link to that custom file and the jQuery documentation.
With #LazyOne's help, I was even able to download what are hopefully the right docs from api.jquery.com. However, the results are mixed:
From good...
To poor...
To non-existent...
To errors...

I'm having the same results and this looks like a bug. I've tried the same project in 2016.3.3 and it showed me correct documentation while in 2017.2.3 IDE displays 2 identical links that do not work. You might want to report this at http://youtrack.jetbrains.com/issues/WEB#newissue=yes. This is also looks like a https://youtrack.jetbrains.com/issue/IDEA-77527 regression

Related

ReadTheDocs: Publishing Pre-Built HTML Pages to ReadTheDocs

I was trying to create documentation from python doc strings, and found pdoc. If you don't know, it creates html documentation from python doc strings. Since it generates .html files and not .rst, how do I publish those to ReadTheDocs or generate .rst files using pdoc?
Quick sidenote: I don't want to use sphinx since 1) the theme pdoc has is pretty cool and 2) I don't know how to generate documentation from docstrings using sphinx (all the tutorials I looked at didn't help).
Read the Docs released a beta feature some time ago that allows you to completely override the build process. This means that you can execute custom commands (e.g. pdoc) and output all the HTML to a particular directory (_readthedocs/html). Once the build is finished, Read the Docs will publish the content of that directory.
Check out the documentation at https://docs.readthedocs.io/en/stable/build-customization.html#override-the-build-process

PhpStorm 10 Download to Library issues (JS yes, CSS no)

I'm just wondering how I can customize the part where PhpStorm allows only to d/l jQuery or other related scripts into library, yet no CSS option to d/l into library.
Of course that the solution is to create a new file > copy the name of the filename > paste it into the name > copy the contents of the bootstrap.min link, paste it in the new created file.
I'm trying to get an automated "d/l into library" option working for CSS, which is pretty cardinal, considering the fact that no bootstrap class hinting will appear in PhpStorm until you have a local/cached library for bootstrap
This functionality is not yet implemented (latest stable is v2016.2).
https://youtrack.jetbrains.com/issue/WEB-10023 -- watch this ticket (star/vote/comment) to get notified on any progress.

WebStorm reports a "missing import" on built-in objects

I've an ES6 project in WebStorm which obviously sometimes uses some built-in objects like Math or JSON.
Both HTML / ECMAScript 5 and ECMAScript 6 are enabled in "Settings/(...)/JavaScript/Libraries", yet WebStorm still suggests that Math and JSON are missing imports.
When I create an empty new project it works fine. I also noticed that when selecting JSON in such new project and pressing CTRL+B, WebStorm shows definitions from its internal library.
To the contrary in my main project it shows some TypeScript ones from completely unrelated part of the project. If I move the folder with typescript outside the project it seems to work.
Nota bene, the file I have errors in is not written in TypeScript, does not include anything TypeScript related and is not processed with TypeScript in any way. It is only processed with ES6 to ES5 transpiler.
This worked for me:
Navigate Settings -> Languages & Frameworks -> Node.js and NPM
Click Enable for Node.js Core library under Coding Assistance section
Click Apply
I restarted WebStorm and warnings went away.
Marking the directory with TypeScript based subproject as excluded (right click → “Mark Directory as” → “Excluded”) solves the problem without need to physically remove it from the project.
I had the same issue and I found the solution:
For me it was because I had a ECMA 5.1 project with a subfolder in ECMA 6.
Just invert it: Set all ECMA 5.1 files in ECMA 5.1 and set the main project version to ECMA 6.

phpstorm unresolved function or method $()

I have the following problem: phpstorm do not recognize jquery methods and here and there I see
Unresolved function or method $()
This was bugging me for sometime but finally I tried to get rid of it with File->Settings->JavaScript->Libraries and adding jquery as a global / project.
My library setup looks like this:
But is has not changed anything. I still see those pesky notices. Does anyone know how to get rid of them?
There is a really stupid workaround,
Download the Library (in this case jQuery) from inside the IDE itself.
Open up settings (Ctrl + Alt + S on Linux)
Navigate to Languages & Frameworks -> Javascript -> Libraries
Click Download and choose jQuery
Hopefully the errors will vanish
EDIT:
After running the IDE through Fiddler, I realised this only solves the problem because of the version the IDE downloads.
So, the correct workaround is to Add older, non-AMD jQuery versions as a Global scoped Library and add the latest one as a Project scope library.
The latest non-AMD versions are:
1.10.2 for 1.x series. And, 2.0.0 for 2.x series.
I had the same issue with version 1.11.2, and resolved it simply by adding the uncompressed version into my js folder.
Just copy the uncompressed version of jQuery into your project folder.
you don't even need to import it into your project, just copy it to javascript folder.
The jQuery v1.11.0 shows exactly the same behaviour here as well. At the same time previous version 1.10.2 works fine in IDE (no warnings).
I think it has something to do with "AMD-fy jQuery source" ticket (http://bugs.jquery.com/ticket/14113) -- looks like IDE has some issues figuring out this style.
If you wish (and can) -- roll back to jQuery v1.10.2 (which is like half a year old, which means it's stable and still good to use).
Hopefully IDE will be able to properly parse this new jQuery style in next release.
Actual ticket: http://youtrack.jetbrains.com/issue/WEB-10908
If you import both 1.11.0 and 1.10.2 in phpstorm it will be resolved
You don't have to rollback your project.

Is it possible to browse the source of OpenJDK online?

Is it possible to browse the source code of OpenJDK online, just like I can do with SourceForge's projects? I never used Mercury before, so I felt confused.
(Note: I don't want to download the source. I just want to browse it online, to see how some methods are implemented.)
OpenJDK is now on GitHub: https://github.com/openjdk/jdk
It is a large project, but you will find the implementations of the core classes under jdk/src/java.base/share/classes.
For instance you can find the implementation of java.util.List here.
If you need to browse older versions, you still need to use the old Mercurial interface.
The Mercurial interface there is quite confusing if you are not used to it, and since this is a large project, it can be hard to find what you are looking for.
Here is an example:
To find the JDK6 implementation java.util.List, select jdk6, jdk, select browse. Then browse to src/share/classes/java/util/List.java.
You should end up at http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/tip/src/share/classes/java/util/List.java
The latest JDK 8 OpenJDK Java Class Library source code can be found here: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/tip/src/share/classes/
Here is the basic step to get latest or any released version of Openjdk 8 (or any existing java version) source code, and use them in Eclipse.
Steps:
[browse source]
Open url for jdk, e.g http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/
click tags
choose proper tag, e.g jdk8u73-b02
then click browse,
then browse into folder src/share/classes,
[download source]
then click one of bz2 / zip / gz, to download source in relevant compressed format, (e.g for jdk8u73-b02 in zip format, the url will be: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/archive/2ab13901d6f1.zip/src/share/classes/)
[use in eclipse]
uncompress it,
zip the folder "classes/", make "classes/" as the root dir of .zip file, (e.g first cd jdk-2ab13901d6f1/src/share/, then zip -r openjdk_8u73_b2_src.zip classes/)
move the created zip file to proper location, it will stay there for a while, (e.g mv openjdk_8u73_b2_src.zip /media/Eric/software/java/jdk/openjdk/openjdk8u73-b02/source/)
in eclipse, specify source file for jars of installed jre, could specify the source attachment for each jar of installed jre respectively, the most common jar is probably rt.jar,
optionally, might need refresh project to make it totally take effect, not sure is that necessary,
test it: in eclipse, ctrl + shift + t, then input Cancellable, select the sun.nio.fs.Cancellable of corresponding installed jre,
if the source code is available, then it's good, because this source is not available in jdk_home/src.zip, it must be from the additional openjdk source,
switch source back: could switch back to use "jdk_home/src.zip", if don't want to use the external openjdk source,
ok
Here's a way to browse the repositories and look at just the bits you want.
http://hg.openjdk.java.net/
Is that what you are asking?
Append a "/file" to the root URLs to view the browser like this:
http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/
http://hg.openjdk.java.net/jdk7/jdk7/hotspot/file
Grepcode.com is great for similar things - not only OpenJDK sources, with searching in classes/methods and links between classes directly in highlighted code:
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8-b132/java/net/Socket.java
As mentioned in the other answers, the source code repository is at https://hg.openjdk.java.net
However, the OpenJDK team mirrors some of the projects on GitHub: https://github.com/openjdk
Including the latest Java version project (https://hg.openjdk.java.net/jdk/jdk): https://github.com/openjdk/jdk
Surely http://hg.openjdk.java.net is one good option. The other equally good source is zGrepCode https://zgrepcode.com/java/openjdk/ . It has both Open JDK and Oracle java versions.